Handshake synchronization by adjusting status of status machine of receiving end to a state indicated by status reset signal

ABSTRACT

A handshake synchronization restoration method and system based on visible light communication are provided. The method includes: after a transmitting end in which a state machine varies with unit time is powered on again, transmitting in the form of a visible light signal, to a receive and control system, a status reset signal which varies with unit time, wherein the receive and control system comprises one or multiple receiving ends; and receiving, by the receive and control system, the visible light signal, and when it is determined that the received visible light signal is a status reset signal, adjusting status of a state machine of a receiving end to a state indicated by the status reset signal. Status synchronization with the transmitting end is restored, avoiding a case in which the transmitting end is asynchronous with the receiving end after encountering power outage and being powered on again.

CROSS-REFERENCE TO RELATED APPLICATION

This application is a divisional of application Ser. No. 14/405,787 (nowU.S. Pat. No. 9172464), filed Dec. 5, 2014, which is the National Stageof International Application No. PCT/CN2013/075281, filed May 7, 2013,which claims the benefit of Chinese Patent Application No.201210184610.2, filed Jun. 6, 2012, Chinese Patent Application No.201210205400.7, filed Jun. 20, 2012 and Chinese Patent Application No.201210222257.2, filed Jun. 29, 2012.

TECHNICAL FIELD

The disclosure relates to the field of photonic Internet of Thingstechnologies, and in particular, to a handshake synchronization methodand system based on visible light communication.

BACKGROUND

Visible light communication is an emerging and short-distance high-speedwireless optical communications technology that is developed on a basisof a light emitting diode (LED) technology. A basic principle of visiblelight communication is that communication is conducted by blinking anLED light source at a high frequency based on the characteristics that aswitching speed of an LED is faster than that of a fluorescent lamp andan incandescent lamp. Presence of light indicates binary 1, and absenceof light indicates binary 0. Information may be obtained after ahigh-speed optical signal that includes digital information undergoesphotovoltaic conversion. In the wireless optical communicationstechnology, data is unlikely to be interfered or captured, and anoptical communication device can be easily made and are unlikely to bedamaged or demagnetized. Therefore, the wireless optical communicationstechnology can be used to make a wireless optical encryption key.Compared with a microwave technology, wireless optical communication hasrelatively rich spectrum resources, which is unmatched by commonmicrowave communication and wireless communication. In addition, visiblelight communication is applicable to any communications protocol, and issuitable for any environment. In terms of security, compared withconventional magnetic materials, there is no need to worry about aproblem of degaussing, or even to worry about that communication contentis intercepted. Besides, optical wireless communication equipmentfeatures flexible and convenient installation and layout, and low costs,and thus is applicable to large-scale popularity and application.

The Internet of Things is a network that is based on an informationcarrier, such as the Internet, a conventional telecommunicationsnetwork, or the like, so that all common physical objects that can beindividually addressable can implement interconnection and interworking.The Internet of Things refers to that ubiquitous terminal devices andfacilities implement interconnection and interworking by using variouswireless or wired long-distance or short-distance communication networksto provide secure, controllable and even personalized management andservice functions such as real-time online monitoring, positioningtracing, alarm linkage, scheduling and dispatching, plan management,remote control, security protection, remote maintenance, online upgrade,statistical reporting, decision-making support, and leader desktop, soas to implement integration of “management, control, and operation” ofhigh efficiency, energy saving, security, environmental protection ofdevices. A conventional Internet of Things generally implementsinterconnection and interworking by using various wireless or wiredcommunication networks, and adopts a conventional communicationstechnology.

In the related art, the Internet of Things using the visible lightcommunications technology is called the photonic Internet of Things.Visible light has higher security than wireless communication due tocharacteristics that visible light has high directivity, and cannotpenetrate a barrier. The photonic Internet of Things uses an LEDemitting a strobe signal as a media of wireless communication for thephotonic Internet of Things. The so-called strobe signal, which is apulsing modulated signal emitted by turning on and off an LED, wherepresence of light indicates 1, and absence of light indicates 0, after ashort-distance propagation, undergoes photovoltaic conversion to obtaininformation. Visible light has high directivity and cannot penetrate abarrier, and therefore has higher security than the Internet of Thingsthat uses a wireless communications manner.

However, in the current photonic Internet of Things technology, originaldata is not encrypted, but a signal is modulated directly onto a visiblelight signal for transmission, or a transmitting end and a receiving endonly use a fixed encryption signal (for example, a pseudocode signal)not varying with time to perform encryption. If a high-speed camera isused for shooting, a light signal with a same strobe might bereplicated. Because a pseudocode signal used for decryption by thereceiving end is fixed, the replicated optical signal may also beidentified by the receiving end and correctly decrypted. Therefore, suchencryption is useless. To sum up, the existing photonic Internet ofThings has security risks.

SUMMARY

To solve the technical problem, the embodiments of the disclosureprovide a handshake synchronization method and system based on visiblelight communication, which can improve security of a photonic Internetof Things.

One embodiment of the disclosure provides a handshake synchronizationmethod for a visible light signal, including:

connecting, by a transmitting end in which a state machine varies withunit time, to a receiving end, and adjusting, by the receiving end,status of a state machine of the receiving end to be synchronous withstatus of the state machine of the transmitting end in the currentperiod of time;

performing, by the transmitting end, a logical operation on an originalsignal and a pilot optical signal separately with a pseudocode signal ofthe current period of time to obtain an encrypted original signal and anencrypted pilot optical signal, combining the encrypted original signaland the encrypted pilot optical signal to obtain the scrambled signal,and sending the scrambled signal in the form of a visible light signal;and

receiving, by the receiving end, the visible light signal, andconverting the visible light signal into a digital signal and thenperforming decomposition to obtain an encrypted original signal and anencrypted pilot optical signal; after inverting the encrypted pilotoptical signal, comparing an inverted encrypted pilot optical signalwith a pseudocode signal corresponding to current status; and if theinverted encrypted pilot optical signal is the same as the pseudocodesignal corresponding to the current status, using the pseudocode signalcorresponding to the current status to decrypt the encrypted originalsignal.

In the described embodiment, the state machine provides large numbers inascending order or in descending order and the large numbers are notcyclic in a preset period of time.

In the described embodiment, the pilot optical signal includes a pilotoptical signal 1 and a pilot optical signal 2, and before the method,the following is further included:

setting, by the transmitting end, a structure of the logical operationfor each user: a first layer, where the pilot optical signal 1represents a different user and is encrypted by using a staticencryption algorithm; and a second layer, where the pilot optical signal2 is status of a state machine of a unique dynamic encryption algorithmof the user represented by the pilot optical signal 1;

setting, by the receiving end, a structure of a corresponding logicaloperation: a first layer, where an encrypted signal of the pilot opticalsignal 1 is decrypted by using the static encryption algorithm, andthere is a table that corresponds to decrypted information, so that theuser can be found; and a second layer, where ever-changing state machineinformation of the user is found by using information about the pilotoptical signal 2.

In the described embodiment, after the setting, by the transmitting end,a structure of the logical operation for each user, the method furtherincludes:

setting a third layer, where the state machine corresponds to thedynamic encryption algorithm of the user; and

correspondingly, after the setting, by the receiving end, a structure ofa corresponding logical operation, the method further includes:

setting a third layer, where a scrambling code of a dynamic encryptionalgorithm sequence of the user at this moment can be found according totransition of a state machine, and ID information of the user isdecrypted by using the scrambling code.

In the described embodiment, the adjusting, by the receiving end, statusof a state machine of the receiving end to be synchronous with status ofthe state machine of the transmitting end specifically includes:

allocating, by a system, an exclusive ID, a dynamic encryptionalgorithm, and a state machine for a user corresponding to the receivingend, and enabling a start bit of a state machine of the system to be thesame as that of an end user at a first interconnection moment; and ifthe end user has lost synchronization with the system, having tore-interconnect, by the end user, with the system, so that the start bitthat is of the state machine of the user and stored in the system is thesame as that of the state machine of the end user.

In the described embodiment, the method further includes: controlling,by the receiving end if determining that the received original signal islegal, an action of a functional unit connected to the receiving end.

In the described embodiment, before the sending the scrambled signal inthe form of a visible light signal, the method further includes:modulating the scrambled signal.

In the described embodiment, after the receiving, by the receiving end,the visible light signal, the method further includes: demodulating thedigital signal.

In the described embodiment, frequencies of the original signal, thepilot optical signal, and the pseudocode signal are the same or in aninteger multiple relationship, and start and end phases of the originalsignal, the pilot optical signal, and the pseudocode signal are thesame.

Another embodiment of the disclosure provides a handshakesynchronization system for a visible light signal, including atransmitting end and a receiving end, where:

a state machine of the transmitting end varies with unit time, and isconnected to the receiving end in a preset period of time; and thetransmitting end includes: a first pseudocode generator, configured tooutput a pseudocode signal which varies with unit time; a pilot opticalsignal generator, configured to output a pilot optical signal; anencoder, configured to perform a logical operation on an original signaland a pilot optical signal separately with a pseudocode signal of thecurrent period of time to obtain an encrypted original signal and anencrypted pilot optical signal, and combine the encrypted originalsignal and the encrypted pilot optical signal to obtain the scrambledsignal; and a sending unit, configured to send the scrambled signal in ablinking form; and

a state machine of the receiving end is synchronous with status of thestate machine of the transmitting end in the preset period of time; andthe receiving end includes: a receiving unit, configured to receive thevisible light signal and convert the visible light signal into a digitalsignal; a decomposing unit, configured to decompose the digital signalto obtain an encrypted original signal and an encrypted pilot opticalsignal; an inverter, configured to invert the encrypted pilot opticalsignal; a second pseudocode generator, configured to output a pseudocodesignal which varies with unit time; a pseudocode determiner, configuredto, after the encrypted pilot optical signal is inverted, compare aninverted encrypted pilot optical signal with a pseudocode signalcorresponding to current status; and a decoder, configured to use thepseudocode signal corresponding to the current status to decrypt theencrypted original signal.

In the described embodiment, the receiving end further includes: anoriginal signal determiner, connected to the decoder and the pseudocodedeterminer, and configured to compare a decrypted original signal withan original signal prestored in the pseudocode determiner and determinelegality of a received original signal.

In the described embodiment, the transmitting end further includes: amodulator, connected between the encoder and the sending unit, andconfigured to modulate the scrambled signal.

In the described embodiment, the receiving end further includes: ademodulator, connected between the receiving unit and the decomposingunit, and configured to demodulate the digital signal.

In the described embodiment, the first pseudocode generator and thesecond pseudocode generator have same operating status, and a frequencythat is the same or in an integer multiple relationship.

Still another embodiment of the disclosure provides a handshakesynchronization method based on visible light communication, including:

connecting, by a transmitting end, in which a state machine varies withunit time, to a receive and control system, and adjusting, by thereceive and control system, status of a state machine of the receive andcontrol system to be synchronous with status of the state machine of thetransmitting end, where the receive and control system includes one ormultiple receiving ends;

performing, by the transmitting end, a logical operation on an originalsignal and a pilot optical signal separately with a pseudocode signal ofthe current period of time to obtain an encrypted original signal and anencrypted pilot optical signal, combining the encrypted original signaland the encrypted pilot optical signal to obtain the scrambled signal,and sending the scrambled signal in the form of a visible light signal;and

receiving, by the receive and control system, the visible light signal,and converting the visible light signal into a digital signal and thenperforming decomposition to obtain an encrypted original signal and anencrypted pilot optical signal; performing a logical operation on theencrypted pilot optical signal with a prestored pseudocode signalcorresponding to a state machine of all users in the current period oftime, and identifying a pseudocode signal corresponding to the pilotoptical signal in the current status according to relevant peaks; andusing the pseudocode signal corresponding to the current status todecrypt the encrypted original signal.

In the described embodiment, the method further includes: comparing, bythe receive and control system, a decrypted original signal with aprestored original signal, and determining legality of a receivedoriginal signal.

In the described embodiment, the method further includes: controlling,by the receive and control system if determining that the receivedoriginal signal is legal, an action of a functional unit connected tothe receive and control system.

In the described embodiment, before the sending the scrambled signal inthe form of a visible light signal, the method further includes:modulating the scrambled signal.

In the described embodiment, after the receiving, by the receive andcontrol system, the visible light signal, the method further includes:demodulating the digital signal.

In the described embodiment, frequencies of the original signal, thepilot optical signal, and the pseudocode signal are the same or in aninteger multiple relationship, and start and end phases of the originalsignal, the pilot optical signal, and the pseudocode signal are thesame.

Yet another aspect of the disclosure provides a handshakesynchronization system based on visible light communication, including atransmitting end and a receive and control system, where the receive andcontrol system includes one or multiple receiving ends; where

a state machine of the transmitting end varies with unit time, and isconnected to the receive and control system in a preset period of time;and the transmitting end includes: a pseudocode generator, configured tooutput a pseudocode signal which varies with unit time; a pilot opticalsignal generator, configured to output a pilot optical signal; anencoder, configured to perform a logical operation on an original signaland a pilot optical signal separately with a pseudocode signal of thecurrent period of time to obtain an encrypted original signal and anencrypted pilot optical signal, and combine the encrypted originalsignal and the encrypted pilot optical signal to obtain the scrambledsignal; and a sending unit, configured to send the scrambled signal in ablinking form; and

when the receive and control system is connected to the transmittingend, status of a state machine of the receive and control system issynchronous with status of the state machine of the transmitting end;and each receiving end includes: a receiving unit, configured to receivethe scrambled signal; a decomposing unit, configured to decompose thescrambled signal to obtain an encrypted original signal and an encryptedpilot optical signal; a pseudocode determiner, configured to, perform alogical operation on the encrypted pilot optical signal with a prestoredpseudocode signal corresponding to a state machine of all users in thecurrent period of time, and determine a pseudocode signal correspondingto the current status according to relevant peaks; and a decoder,configured to use the pseudocode signal corresponding to the currentstatus to decrypt the encrypted original signal.

In the described embodiment, the receiving end further includes: anoriginal signal determiner, connected to the decoder and the pseudocodedeterminer, and configured to compare a decrypted original signal withan original signal prestored in the pseudocode determiner and determinelegality of a received original signal.

In the described embodiment, the transmitting end further includes: amodulator, connected between the encoder and the sending unit, andconfigured to modulate the scrambled signal.

In the described embodiment, the receiving end further includes: ademodulator, connected between the receiving unit and the decomposingunit, and configured to demodulate the digital signal.

In the described embodiment, the receive and control system furtherincludes a system control platform connected to the receiving end.

Yet still another aspect of the disclosure provides a handshakesynchronization restoration method, including:

after a transmitting end in which a state machine varies with unit timeis powered on again, transmitting in the form of a visible light signal,to a receive and control system, a status reset signal which varies withunit time, where the receive and control system includes one or multiplereceiving ends; and

receiving, by the receive and control system, the visible light signal,and when it is determined that the received visible light signal is astatus reset signal, adjusting status of a state machine of a receivingend to a state indicated by the status reset signal.

In the described embodiment, before the method, the following is furtherincluded: connecting, by the transmitting end, to the receive andcontrol system, and adjusting, by the receive and control system, thestatus of the state machine of the receiving end to be synchronous withstatus of the state machine of the transmitting end; performing, by thetransmitting end, a logical operation on an original signal and a pilotoptical signal separately with a pseudocode signal of the current periodof time to obtain an encrypted original signal and an encrypted pilotoptical signal, combining the encrypted original signal and theencrypted pilot optical signal to obtain the scrambled signal, andsending the scrambled signal in the form of a visible light signal;receiving, by the receive and control system, the scrambled signal, anddecomposing the scrambled code into the encrypted original signal andthe encrypted pilot optical signal; performing a logical operation onthe encrypted pilot optical signal with a prestored pseudocode signalcorresponding to a state machine of all users in the current period oftime, and identifying a pseudocode signal corresponding to the pilotoptical signal in the current status according to relevant peaks; andusing the pseudocode signal corresponding to the current status todecrypt the encrypted original signal.

In the described embodiment, the method further includes: comparing, bythe receive and control system, a decrypted original signal with aprestored original signal, and determining legality of a receivedoriginal signal; and controlling, by the receive and control system ifdetermining that the received original signal is legal, an action of afunctional unit connected to the receive and control system.

In the described embodiment, frequencies of the original signal, thepilot optical signal, and the pseudocode signal are the same or in aninteger multiple relationship, and start and end phases of the originalsignal, the pilot optical signal, and the pseudocode signal are thesame.

In the described embodiment, before the sending the scrambled signal inthe form of a visible light signal, the method further includes:modulating the scrambled signal; and correspondingly, after thereceiving, by the receive and control system, the visible light signal,the method further includes: demodulating the digital signal.

Yet still another aspect of the disclosure provides a handshakesynchronization restoration system, including a transmitting end and areceive and control system, where the receive and control systemincludes one or multiple receiving ends; where:

the transmitting end in which a state machine varies with unit timeincludes: a status reset unit, configured to, after being powered on,transmit, to the receive and control system, a status reset signal whichvaries with unit time; and a transmitting unit, connected to the statusreset unit and configured to transmit the status reset signal in theform of a visible light signal; and

each receiving end of the receive and control system includes: areceiving unit, configured to receive the visible light signal; and astatus reset determiner, connected to the receiving unit and configuredto, when it is determined that the received visible light signal is astatus reset signal, output an instruction for adjusting status of astate machine to a state indicated by the status reset signal.

In the described embodiment, the transmitting end further includes: apseudocode generator, connected to the status reset unit and configuredto output a pseudocode signal which varies with unit time; a pilotoptical signal generator, configured to output a pilot optical signal;and an encoder, configured to perform a logical operation on an originalsignal and a pilot optical signal separately with a pseudocode signal ofthe current period of time to obtain an encrypted original signal and anencrypted pilot optical signal, and combine the encrypted originalsignal and the encrypted pilot optical signal to obtain the scrambledsignal; and the receiving end further includes: a pseudocode determiner,connected to the status reset determiner and configured to perform alogical operation on the encrypted pilot optical signals output by thestatus reset determiner with a pseudocode signal that is prestored inthe system and corresponds to a state machine of all users in thecurrent period of time, and determine a pseudocode signal correspondingto current status of a period of time according to relevant peaks; and adecoder, connected to the status reset determiner and configured to usethe pseudocode signal corresponding to the current status to decrypt theencrypted original signal output by the status reset determiner.

In the described embodiment, the receiving end further includes: anoriginal signal determiner, connected to the decoder and the pseudocodedeterminer, and configured to compare a decrypted original signal withan original signal prestored in the pseudocode determiner and determinelegality of a received original signal.

In the described embodiment, the transmitting end further includes: amodulator, connected between the encoder and the sending unit, andconfigured to modulate the scrambled signal; and correspondingly, thereceive and control system further includes: a demodulator, connectedbetween the receiving unit and the decomposing unit, and configured todemodulate the digital signal.

In the described embodiment, the receive and control system includes asystem control platform connected to the receiving end.

Compared with the related art, the foregoing technical solutions havethe following advantages: A visible light signal transmitted between atransmitting end and a receiving end is not an original signal but is anencrypted scrambled signal, and the scrambled signal varies with unittime. A current period of time is different from a next period of time.Therefore, it is not easy for cracking, thereby improving security of aphotonic Internet of Things.

BRIEF DESCRIPTION OF DRAWINGS

To describe the technical solutions in the embodiments of the disclosuremore clearly, the following briefly introduces the accompanying drawingsrequired for describing the embodiments.

FIG. 1 is a flowchart of a handshake synchronization method for avisible light signal according to Embodiment 1 of the disclosure;

FIG. 2 is a flowchart of a handshake synchronization method for avisible light signal according to Embodiment 2 of the disclosure;

FIG. 3 is a schematic structural diagram of a handshake synchronizationsystem for a visible light signal according to Embodiment 3 of thedisclosure;

FIG. 4 is a schematic structural diagram of a handshake synchronizationsystem for a visible light signal according to Embodiment 4 of thedisclosure;

FIG. 5 is a flowchart of a handshake synchronization method for avisible light signal according to Embodiment 5 of the disclosure;

FIG. 6 is a flowchart of a handshake synchronization method for avisible light signal according to Embodiment 6 of the disclosure;

FIG. 7 is a schematic structural diagram of a handshake synchronizationsystem for a visible light signal according to Embodiment 7 of thedisclosure;

FIG. 8 is a schematic structural diagram of a handshake synchronizationsystem for a visible light signal according to Embodiment 8 of thedisclosure;

FIG. 9 is a schematic structural diagram of a handshake synchronizationsystem for a visible light signal according to Embodiment 9 of thedisclosure;

FIG. 10 is a flowchart of a handshake synchronization restoration methodaccording to Embodiment 10 of the disclosure;

FIG. 11 is a flowchart of a handshake synchronization restoration methodaccording to Embodiment 11 of the disclosure;

FIG. 12 is a flowchart of a handshake synchronization restoration methodaccording to Embodiment 12 of the disclosure;

FIG. 13 is a schematic structural diagram of a handshake synchronizationrestoration system according to Embodiment 13 of the disclosure;

FIG. 14 is a schematic structural diagram of a handshake synchronizationrestoration system according to Embodiment 14 of the disclosure; and

FIG. 15 is a schematic structural diagram of a handshake synchronizationrestoration system according to Embodiment 15 of the disclosure.

DESCRIPTION OF EMBODIMENTS

The following clearly and completely describes the technical solutionsin the embodiments of the disclosure with reference to the accompanyingdrawings in the embodiments of the disclosure. Apparently, the describedembodiments are merely a part rather than all of the embodiments of thedisclosure. All other embodiments obtained by a person of ordinary skillin the art based on the embodiments of the disclosure without creativeefforts shall fall within the protection scope of the disclosure.

The disclosure is characterized in encrypting a strobe signal of visiblelight in a free spatial environment. An LED strobe signal emitted from atransmitting end, if shot by using a high-speed camera, may bereplicated to obtain an optical signal with a same strobe. Because inthe related art, information used for decoding by a receiving end is notencrypted or an encrypted pseudocode signal is fixed, a replicatedoptical signal may be identified by the receiving end and correctlydecrypted. Therefore, encryption is useless, leading to a security risk.For this, a dynamic encryption method is proposed, and aims to make atransmitted ID time-varying by means of dynamic encryption. In addition,an ID is valid for one time only. A previous ID is invalid, and acurrent ID can be correctly identified by the receiving end. A set ofcomprehensive solutions are proposed, and the solutions are as follows:

1. In the disclosure, pilot optical signals and an original signal arephysically connected together, and propagated, consecutively in terms oftime, toward free space by using a transmitting end.

2. Information in the disclosure is implemented by controlling blinkingof an LED. Light propagation of the LED in free space indicates 1, andLED off indicates 0. An implementation means is to perform a logicaloperation on the pilot optical signals and the original signal with thescrambled signal, and impose on an LED driver to drive the LED to be onor off.

3. Because an LED of a mobile phone blinks at a relatively low speed, abit rate of valid information transmitted by strobing is relatively low,lower than 100 bit/s, which is different from existing communicationstechnologies such as wireless communications and optical fibercommunications. A rate in a modern traditional communication technologyis fast, and a rate in wireless communications and optical fibercommunications is over 100 times higher than that of visible lightcommunication by strobing by a mobile phone. Therefore, for example,wireless communications may use a relatively long dynamic encryptionsequence on an air interface. The dynamic encryption sequence may beallocated to different users, and all users may share a unified dynamicencryption sequence, such as a 256-bit pseudo random sequence. Becausethere are only valid information bits of less than 100 bits, it isimpossible to use a unified dynamic encryption sequence. If a parity bitis deducted and a light guide channel is deducted, the number of bitsthat are actually left for a user is relative small. The solutions areas follows:

A: A different dynamic encryption sequence is set for each customer,that is, a sequence for a dynamic encryption algorithm of each customeris different. Otherwise, if a unified dynamic encryption algorithm isused, a problem that the number of bits of valid available informationis insufficient exists. Under a limited information bit length, usingunified dynamic encryption has a security problem, which is easy to becracked.

When an end user is connected to a system for the first time, the systemallocates the user an exclusive ID, a dynamic encryption algorithm, anda state machine, so that at an interconnection moment for the firsttime, a start bit of the state machine is the same between the systemand the end user. If the end user has lost synchronization with thesystem, the end user has to re-interconnect with the system, so that thestart bit that is of the state machine of the user and stored in thesystem is the same as that of the state machine of the end user.

B: Pilot optical signal 1 and pilot optical signal 2 are set up, wherethe pilot optical signal 1 is used to identify a different user, and thepilot optical signal 2 represents a state machine corresponding to theuser. A transition state on the state machine corresponds to the dynamicencryption algorithm for the user.

Therefore, the solution is to provide an exclusive dynamic encryptionalgorithm for each user, and on an air interface, an encryption methodfor each user is an exclusive there-layer logical structure. A firstlayer: a pilot optical signal 1 represents a different user in thesystem, and is encrypted by using a static encryption algorithm; asecond layer: a pilot optical signal 2 is status of a state machine of aunique dynamic encryption algorithm of the user represented by the pilotoptical signal 1; and a third layer: the state machine corresponds tothe dynamic encryption algorithm of the user. At the receiving end,there is a corresponding logical structure: a first layer where a staticencryption algorithm decrypts an encrypted signal of the pilot opticalsignal 1, and there is a table that corresponds to decryptedinformation, so that the user can be found; and a second layer, whereever-changing state machine information of the user is found by usinginformation about the pilot optical signal 2.; and a third layer, wherea scrambling code of a dynamic encryption algorithm sequence of the userat this moment can be found according to transition of a state machine,and ID information of the user can be decrypted by using the scramblingcode.

C: As described above, because a problem that the number of bits ofvalid available information is insufficient exists, the user describedabove may not be in a one-to-one correspondence with an actual end user.Several actual end users may share one user in a dynamic encryptionsystem, that is, share one dynamic encryption algorithm.

D: Likewise, because bits of valid available information areinsufficient, after a period of time, there is a dynamic encryptionalgorithm circulated back to an initial state. Because of differentencryption algorithms of different users, and bits of information arequite limited, once an encryption algorithm is circulated back, forexample, a pseudo random sequence formed by a 32-bit trigger is back toan initial state, a decryption disorder is caused, resulting in, forexample, incorrect identification of an ID, for example, an ID isidentified as another ID, and a correct ID cannot be unidentified. As aresult, an entire encryption system crashes. Therefore, a differencefrom an existing encryption technology lies in that an exclusive statemachine is set, where the state machine is large numbers in ascendingorder or in descending order. It is ensured that the large numbers arenot circulated back in ascending order or in descending order in scoresof years, thereby ensuring orderly transition, in the system, of manydynamic encryption algorithms in limited information bits. The receivingend makes a determination on the large numbers. For example, inascending order, if a received state machine status number is smallerthan a previous number, a rule of no cycling for ascending order in thesystem is violated. Therefore, it can be determined that the signal is areplicated illegal signal. Conversely, if a state machine status numberreceived by the receiving end is larger than a number previouslyreceived by the receiving end, it is passed, and the system proceedswith a next step.

E: As described above, because a dynamic encryption mechanism of eachuser is different, interconnection and synchronization, of a statemachine of each user, with the system are very important. To ensureorderly working of dynamic encryption systems of an entire system, anexclusive handshake synchronization mechanism is set up. When an enduser is connected to a system for the first time, the system allocatesthe user an exclusive ID, a dynamic encryption algorithm, and a statemachine, so that at an interconnection moment for the first time, astart bit of the state machine is the same between the system and theend user. If the end user has lost synchronization with the system, theend user has to re-interconnect with the system, so that the start bitthat is of the state machine of the user and stored in the system is thesame as that of the state machine of the end user.

In summary, the disclosure provides a method in which a transmitting endencrypts an original signal, and a receiving end decrypts an encryptedsignal to restore the original signal in a photonic Internet of Things.In this method, a pseudocode signal used by the transmitting end and thereceiving end keeps changing with time. By using the synchronizationmethod described in the disclosure, the receiving end can identify apseudocode signal used for encryption, and a pseudocode signal used fordecryption can keep highly consistent with a pseudocode signal of thetransmitting end, so that correct decryption can be performed. Becausethe pseudocode signal used by the transmitting end and the receiving endkeeps changing with time, in a same time, the receiving end can identifywhether a visible light signal transmitted by the transmitting end is alegal signal. Because only an encrypted signal of the current period oftime is valid, and an encrypted signal of a previous period of time isinvalid, a strobe optical signal replicated by shooting by using ahigh-speed camera, when attempting to perform access in other time, isidentified as an illegal signal, and a device at a controlled end cannotbe controlled any more, thereby improving security of a system in aphotonic Internet of Things.

The disclosure further provides a restoration method aftersynchronization is lost. In a case, for example, when a transmitting endencounters power outage and then is powered on again, status of thetransmitting end is that synchronization information is lost, and isrestored to an initial state. However, status of a receiving end at thismoment may not be an initial state. In this case, the transmitting endand the transmitting end cannot keep synchronous, that is, a pseudocodesequence used by the transmitting end for encryption is inconsistentwith a pseudocode sequence used by the receiving end for decryption.Therefore, a visible light signal transmitted by the transmitting endcannot be correctly decrypted at the receiving end. After thetransmitting end encounters power outage and is then powered on again, astatus reset signal which varies with unit time is first sent to thereceiving end, and the receiving end adjusts status of a state machineof the receiving end according to the status reset signal, so thatstatus synchronization with the transmitting end is restored, avoiding acase in which the transmitting end is asynchronous with the receivingend after encountering power outage and being powered on again. Inaddition, because the status reset signal varies with unit time, astatus reset signal shot in the current period of time is not applicableto a next period of time, thereby improving security.

Embodiment 1

Referring to FIG. 1, FIG. 1 is a flowchart of a handshakesynchronization method for a visible light signal according toEmbodiment 1 of the disclosure. The method includes:

S101: In the current period of time, a transmitting end in which a statemachine varies with unit time connects to a receiving end.

S102: The receiving end adjusts status of a state machine of thereceiving end to be synchronous with status of the state machine of thetransmitting end.

A handshake between a transmitting end and a receiving end isimplemented by performing S101 and S102.

S103: The transmitting end performs a logical operation on an originalsignal and a pilot optical signal separately with a pseudocode signal ofthe current period of time to obtain an encrypted original signal and anencrypted pilot optical signal.

Frequencies of the original signal, the pilot optical signal, and thepseudocode signal are the same or in an integer multiple relationship,and start and end phases of the original signal, the pilot opticalsignal, and the pseudocode signal are the same.

The original signal is a digital sequence signal, and also calledbaseband data. A pilot optical signal of a period of time is generatedby a pilot optical signal generator, and is a group of all-“1” binarydigits before being scrambled.

For example, in a T1 time, it is assumed that a baseband signal of atransmitting end 1 is0000000000000000000000000000011011111111111111111111111111111111,totaling 64 bits, where the first 32 bits are an original signal of thetransmitting end 1, that is, 00000000000000000000000000000110; and thelast 32 bits are an all-1 pilot optical signal. In a T1 unit time,status of a pseudocode generator is a state 1, and is assumed to be11101001110100111010001001001101; then, the logical operation thereof,that is, an exclusive OR process, is shown in Table 1.

TABLE 1 Logical operation process of an original signal of atransmitting end 1 in a T1 unit time Original 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 signal Pseudocode 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1 signalOutput 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1 signal Original 0 0 0 0 0 0 0 00 0 0 0 1 1 0 signal Pseudocode 0 1 0 0 0 1 0 0 1 0 0 1 1 0 1 signalOutput 0 1 0 0 0 1 0 0 1 0 0 1 0 1 1 signal

It may be learned from Table 1 that a convoluted output signal, that is,the encrypted original guide signal is 11101001110100111010001001001011.

The logical operation on the pilot optical signal with the pseudocodesignal, which is an exclusive OR process shown in Table 2.

TABLE 2 Logical operation process of a pilot optical signal of atransmitting end 1 in a T1 unit time Pilot 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 optical signal Pseudocode 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1 signalOutput 0 0 0 1 0 1 1 0 0 0 1 0 1 1 0 0 0 signal Pilot 1 1 1 1 1 1 1 1 11 1 1 1 1 1 optical signal Pseudocode 0 1 0 0 0 1 0 0 1 0 0 1 1 0 1signal Output 1 0 1 1 1 0 1 1 0 1 1 0 0 1 0 signal

It may be learned from Table 2 that an output signal after the logicaloperation, that is, the encrypted pilot optical signal is00010110001011000101110110110010.

S104: The transmitting end combines the encrypted original signal andthe encrypted pilot optical signal to obtain the scrambled signal.

For example, the encrypted original signal11101001110100111010001001001011 and the encrypted pilot optical signal00010110001011000101110110110010 are combined to obtain the scrambledsignal 1110100111010011101000100100101100010110001011000101110110110010.Herein, the first 32 bits are an encrypted original signal and the last32 bits are an encrypted pilot optical signal for combination. In aspecific process, it may also be that the first 32 bits are an encryptedpilot optical signal and the last 32 bits are an encrypted originalsignal for combination. Other examples are not described herein one byone.

S105: The transmitting end sends the scrambled signal in the form of avisible light signal.

It is assumed that X(t) represents a baseband data signal in a photontransmitter, PW represents a pilot optical signal of the photontransmitter, and PN(t) represents a pseudocode sequence signal; then,the output signal Y(t) may be represented by the following expression:Y(t)=X(t)*PN(t)+PW*PN(t).

If a signal transmitted at this moment is shot for duplication by ahigh-speed camera, the replicated signal is also1110100111010011101000100100101100010110001011000101110110110010.

S106: The receiving end receives the visible light signal and convertsthe visible light signal into a digital signal.

Specifically, the receiving end converts an optical signal into acurrent signal, converts the current signal into a voltage signal, andoutputs the voltage signal as a digital signal.

S107: The receiving end decomposes the digital signal to obtain theencrypted original signal and the encrypted pilot optical signal.

S108: After inverting the encrypted pilot optical signal, the receivingend compares the encrypted pilot optical signal with a pseudocode signalcorresponding to current status; if the inverted encrypted pilot opticalsignal is the same as the pseudocode signal corresponding to the currentstatus, perform S109; otherwise, perform S111.

The received encrypted pilot optical signal is00010110001011000101110110110010, and after being inverted, is11101001110100111010001001001101. The pseudocode signal, correspondingto the current status, of the receiving end is the same as thepseudocode signal, corresponding to the current period of time, of thetransmitting end. Therefore, if the pseudocode signal of the currentstatus of the receiving end is also 11101001110100111010001001001101, itis determined that the received visible light signal is a legal signal.

S109: The receiving end decrypts the encrypted original signal by usingthe pseudocode signal corresponding to the current status, to obtain anoriginal signal.

For example, the logical operation is performed on the pseudocode signal11101001110100111010001001001101 with the encrypted original signal11101001110100111010001001001011 to obtain a decrypted original signal,that is, 00000000000000000000000000000110.

It is assumed that when a T2 period of time arrives, the original signaland the pilot optical signal of the transmitting end 1 remain unchangedand are still0000000000000000000000000000011011111111111111111111111111111111.However, at this moment, the status of the pseudocode generator of thetransmitting end changes, that is, changes to a state 2. It is assumedthat a pseudocode sequence corresponding to the state 2 is10101101010100101011001101011010; then, the transmitting end performsthe logical operation, which is an exclusive OR process shown in Table3.

TABLE 3 Logical operation process of an original signal of atransmitting end 1 in a T2 unit time Original 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 signal Pseudocode 1 0 1 0 1 1 0 1 0 1 0 1 0 0 1 0 1 signalOutput 1 0 1 0 1 1 0 1 0 1 0 1 0 0 1 0 1 signal Original 0 0 0 0 0 0 0 00 0 0 0 1 1 0 signal Pseudocode 0 1 1 0 0 1 1 0 1 0 1 1 0 1 0 signalOutput 0 1 1 0 0 1 1 0 1 0 1 1 1 0 0 signal

It may be learned from Table 3 that an output signal after the logicaloperation, that is, the encrypted original signal, is10101101010100101011001101011100.

The logical operation on the pilot optical signal with the pseudocodesignal, which is an exclusive OR process shown in Table 4.

TABLE 4 Logical operation process of a pilot optical signal of atransmitting end 1 in a T2 unit time Pilot 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 optical signal Pseudocode 1 0 1 0 1 1 0 1 0 1 0 1 0 0 1 0 1 signalOutput 0 1 0 1 0 0 1 0 1 0 1 0 1 1 0 1 0 signal Pilot 1 1 1 1 1 1 1 1 11 1 1 1 1 1 optical signal Pseudocode 0 1 1 0 0 1 1 0 1 0 1 1 0 1 0signal Output 1 0 0 1 1 0 0 1 0 1 0 0 1 0 1 signal

It may be learned from Table 4 that an output signal after the logicaloperation, that is, the encrypted pilot optical signal is01010010101011010100110010100101.

From Table 3 and Table 4, it may be obtained that the pseudocode signaltransmitted by the transmitting end in the T2 unit time is1010110101010010101100110101110001010010101011010100110010100101.

In the T2 period of time, if a signal replicated in the T1 period oftime, that is,1110100111010011101000100100101100010110001011000101110110110010, isused by the receiving end for identification in the T2 period of time,an encrypted pilot signal is 00010110001011000101110110110010, and aninverting operation is performed on the encrypted pilot signal to obtaina signal: 11101001110100111010001001001101. However, in the T2 period oftime, a pseudocode sequence generated by the pseudocode generator of thereceiving end has already changed in the same way as the transmittingend, that is, the pseudocode signal of the current status of thereceiving end is 10101101010100101011001101011010. The two signals aredifferent, and it is determined that the replicated signal is an illegalsignal. Therefore, information replicated in a process of optical signaltransmission cannot be identified by the receiving end in a next periodof time, and becomes expired information, thereby improving security ofa photonic Internet of Things.

Hereto, a handshake synchronization process during signal transmissionbetween the receiving end and the transmitting end is completed. In aspecific implementation process, after S109, the following steps arefurther included:

S110: The receiving end determines that the received original signal islegal, and controls an action of a functional unit connected to thereceiving end, for example, controls to unlock a door lock or controlsan electrical appliance to enter a working state.

S111: End the procedure.

In Embodiment 1, for the step in which the transmitting end performs alogical operation on the original signal and the pilot optical signalseparately with the pseudocode signal of the current period of time, theexclusive OR operation is used as an example for description. In aspecific implementation process, another logical operation, for example,a logical AND operation may further be included, which is not describedherein again.

Embodiment 2

Referring to FIG. 2, FIG. 2 is a flowchart of a handshakesynchronization method for a visible light signal according toEmbodiment 2 of the disclosure. The method includes:

S201: In the current period of time, a transmitting end in which a statemachine varies with unit time connects to a receiving end, and sendsstatus of the state machine of the transmitting end in the currentperiod of time to the receiving end.

S202: The receiving end enables status of a state machine of thereceiving end to be synchronous with the status of the state machine ofthe transmitting end.

A handshake between a transmitting end and a receiving end isimplemented by using S201 and S202.

S203: The transmitting end performs a logical operation on an originalsignal and a pilot optical signal separately with a pseudocode signal ofthe current period of time to obtain an encrypted original signal and anencrypted pilot optical signal.

The pseudocode signal varies with the unit time. The pseudocode signalof the current period of time is discarded in a next period of time, anda new pseudocode signal is used. Frequencies of the original signal, thepilot optical signal, and the pseudocode signal are the same or in aninteger multiple relationship, and start and end phases of the originalsignal, the pilot optical signal, and the pseudocode signal are thesame.

S204: The transmitting end combines the encrypted original signal andthe encrypted pilot optical signal to obtain the scrambled signal.

For example, an encrypted original signal11101001110100111010001001001011 and an encrypted pilot optical signal00010110001011000101110110110010 are combined to obtain the scrambledsignal 1110100111010011101000100100101100010110001011000101110110110010.

S205: The transmitting end modulates the scrambled signal to obtain amodulated signal. S206: The transmitting end sends the modulated signalin the form of a visible light signal. For example, the transmitting endsends the modulated signal in a blinking form by using an LED lamp.

S207: The receiving end receives the visible light signal sent by thetransmitting end, and converts the visible light signal into a digitalsignal.

S208: The receiving end demodulates the digital signal to obtain ademodulated signal.

S209: The receiving end decomposes the demodulated signal to obtain anencrypted original signal and an encrypted pilot optical signal.

S210: After inverting the encrypted pilot optical signal, the receivingend compares the encrypted pilot optical signal with a pseudocode signalcorresponding to current status; if the inverted encrypted pilot opticalsignal is the same as the pseudocode signal corresponding to the currentstatus, perform S211; otherwise, perform S213.

For example, status of a register 1 of the receiving end in a T1 periodof time is a state 1, that is, the pseudocode signal is11101001110100111010001001001101. In this case, the encrypted pilotoptical signal is 00010110001011000101110110110010, and the logicaloperation is performed on the encrypted pilot optical signal with therandom code. By means of relevant peak recognition, a 32-bit all-“1”sequence may be obtained, which indicates that the pseudocode signal isa pseudocode signal used for encryption. The logical operation on theencrypted pilot optical signal with the pseudocode signal, which is anexclusive OR process shown in Table 5.

TABLE 5 Logical operation process of an encrypted pilot optical signalof a receiving end 1 in a T1 unit time Encrypted 0 0 0 1 0 1 1 0 0 0 1 01 1 0 0 0 pilot optical signal Pseudocode 1 1 1 0 1 0 0 1 1 1 0 1 0 0 11 1 signal Pilot 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 optical signalEncrypted 1 0 1 1 1 0 1 1 0 1 1 0 0 1 0 pilot optical signal Pseudocode0 1 0 0 0 1 0 0 1 0 0 1 1 0 1 signal Pilot 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1optical signal

S211: The receiving end decrypts the encrypted original signal by usingthe pseudocode signal corresponding to the current status, to obtain anoriginal signal.

For example, the logical operation is performed on the encryptedoriginal signal 11101001110100111010001001001011 with the pseudocodesignal 11101001110100111010001001001101, which is an exclusive ORprocess shown in Table 6.

TABLE 6 Logical operation process of an encrypted pilot optical signalof a receiving end 1 in a T1 unit time Encrypted 1 1 1 0 1 0 0 1 1 1 0 10 0 1 1 1 original signal Pseudocode 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1signal Output 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 signal Encrypted 0 1 0 00 1 0 0 1 0 0 1 0 1 1 original signal Pseudocode 0 1 0 0 0 1 0 0 1 0 0 11 0 1 signal Output 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 signal

It may be learned from Table 6 that the decrypted original signal is00000000000000000000000000000110.

Hereto, a handshake synchronization process during signal transmissionbetween the receiving end and the transmitting end is completed. In aspecific implementation process, after S211, the following steps arefurther included:

S212: The receiving end determines that the received original signal islegal, and controls an action of a functional unit connected to thereceiving end, for example, controls to unlock a door lock or controlsan electrical appliance to enter a working state.

S213: End the procedure.

In the foregoing synchronization method, even if a visible light signaltransmitted by a transmitting end is shot by a high-speed camera andthen replicated, a replicated signal cannot be synchronous with a statuschange of a receiving end. Therefore, in a different time, even if thereplicated signal is used to attempt to identify the receiving end, itcan be determined that the replicated signal is an illegal signal, sothat security of a photonic Internet of Things can be improved.

The foregoing describes the method embodiments of the disclosure. Thefollowing describes in detail exemplary embodiments of a hardware systemfor running the foregoing method embodiments.

Embodiment 3

Referring to FIG. 3, FIG. 3 is a schematic structural diagram of ahandshake synchronization system for a visible light signal according toEmbodiment 3 of the disclosure. The system 300 includes a transmittingend 301 and a receiving end 302.

A state machine of the transmitting end 301 varies with unit time,connects to the receiving end 302 in a period of time, and sends statusof the state machine of the transmitting end in the current period oftime to the transmitting end 302. The transmitting end 301 includes apseudocode generator 301 a, a pilot optical signal generator 301 b, anencoder 301 c, and a light emitting unit 301 d.

The first pseudocode generator 301 a is configured to generate andoutput a pseudocode signal which varies with unit time. Working statusof the pseudocode generator 301 a varies with the unit time, and theoutput pseudocode signal also varies with the unit time. For example, ina T1 unit time, the status of the pseudocode generator 301 a is a state1, and the output pseudocode signal is 11101001110100111010001001001101;and in a T2 period of time, the status of the pseudocode generator 301 ais a state 2, and the output pseudocode signal is10101101010100101011001101011010.

The pilot optical signal generator 301 b is configured to output a pilotoptical signal. A frequency of the pilot optical signal generator 301 band a working frequency of the pseudocode generator are the same or inan integer multiple relationship.

The encoder 301 c connected to the pilot optical signal generator 301 band the pseudocode generator 301 a is configured to perform a logicaloperation on an original signal and an optical signal, which is outputby the pilot optical signal generator 301 b, separately with apseudocode signal output by the pseudocode generator 301 a in thecurrent period of time to obtain an encrypted original signal and anencrypted pilot optical signal. The encrypted original signal and theencrypted pilot optical signal are combined to obtain the scrambledsignal. For example, an encrypted original signal11101001110100111010001001001011 and an encrypted pilot optical signal00010110001011000101110110110010 are combined to obtain the scrambledsignal 1110100111010011101000100100101100010110001011000101110110110010.Herein, the first 32 bits are an encrypted original signal and the last32 bits are an encrypted pilot optical signal for combination. In aspecific process, it may also be that the first 32 bits are an encryptedpilot optical signal and the last 32 bits are an encrypted originalsignal for combination.

The light emitting unit 301 d connected to the encoder 301 c isconfigured to send, in the form of a visible light signal, the scrambledsignal output by the encoder 301 c. The sending unit 301 c may be alight emitting diode, and may also be another component that has a lightemitting function.

The transmitting end 301 may be a dedicated photon client, a mobilephone, or a handheld electronic device that has a function oftransmitting a visible light signal.

A state machine of the receiving end 302 is synchronous with status ofthe state machine of the transmitting end, including: a receiving unit302 a, a decomposing unit 302 b, an inverter 302 c, a second pseudocodegenerator 302 d, a pseudocode determiner 302 e, and a decoder 302 f.

The receiving unit 302 a receives the visible light signal transmittedby the transmitting end 301 a, and converts the visible light signalinto a digital signal.

The decomposing unit 302 b connected to the receiving unit 302 a isconfigured to decompose the digital signal obtained by conversion by thereceiving unit 302 a to obtain an encrypted original signal and anencrypted pilot optical signal.

The inverter 302 c connected to the decomposing unit 302 b is configuredto invert the encrypted pilot optical signal output by the decomposingunit 302 b.

The pseudocode determiner 302 e connected to the inverter 302 c and thesecond pseudocode generator 302 d is configured to compare an invertedencrypted pilot optical signal output by the inverter 302 c with apseudocode signal that corresponds to current status and is output bythe second pseudocode generator 302 d. If the same, it is determinedthat the scrambled signal is valid. In this embodiment, because thepilot optical signal is an all-“1” digital sequence, the invertedencrypted pilot optical signal is the same as the pseudocode signal ofthe transmitting end. However, the second pseudocode generator 302 d andthe first pseudocode generator 301 a have same operating status, and aworking frequency that is the same or in an integer multiplerelationship. If the scrambled signal received by the receiving end islegal, in a same period of time, pseudocode signals output by the secondpseudocode generator 302 d and the first pseudocode generator301 a arethe same, that is, the inverted encrypted pilot optical signal is thesame as the pseudocode signal that corresponds to the current status andis output by the second pseudocode generator 302 d.

The decoder 302 f connected to the decomposing unit 302 b and thepseudocode determiner 302 e is configured to use the pseudocode signalcorresponding to the current status to decrypt the encrypted originalsignal when the pseudocode determiner 302 e determines that the receivedpseudocode signal is valid.

Embodiment 4

Referring to FIG. 4, FIG. 4 is a schematic structural diagram of ahandshake synchronization system for a visible light signal according toEmbodiment 4 of the disclosure. Compared with Embodiment 3, thetransmitting end 301 in this embodiment further includes:

a modulator 301 e, connected between the encoder 301 c and the sendingunit 301 d, and configured to modulate the scrambled signal.

Correspondingly, the receiving end 302 further includes:

a demodulator 302 g, connected between the receiving unit 302 a and thedecomposing unit 302 b, and configured to demodulate the digital signaloutput by the receiving unit 302 a.

In a specific implementation process, the synchronization system 300 mayfurther include a functional unit connected to the receiving unit 302 a,for example, an electric lock.

The method and system in the embodiments of the disclosure may beimplemented between a transmitting end and a receiving end, and may alsobe implemented between a transmitting end and a receive and controlsystem. Embodiments thereof are introduced in the following.

Embodiment 5

Referring to FIG. 5, FIG. 5 is a flowchart of a handshakesynchronization method for a visible light signal according toEmbodiment 5 of the disclosure. The method includes:

S501: A transmitting end in which a state machine varies with unit timeconnects to a receive and control system. By performing this step, thetransmitting end and the receive and control system implements ahandshake.

The receive and control system may include a system control platform,and each receiving end connected to the system control platform.

Specifically, the state machine of the transmitting end keeps changingwith the unit time. When in a certain period of time, the state machineof the transmitting end is exactly in an N^(th) state (N is a positiveinteger). The transmitting end is connected to the system controlplatform.

S502: The receive and control system adjusts status of a state machineof each receiving end to be synchronous with status of the state machineof the transmitting end.

Specifically, the system control platform adjusts status of a statemachine of the system control platform and the status of the statemachine of each receiving end to be synchronous with the status of thestate machine of the transmitting end, for example, to be in the N^(th)state.

S503: The transmitting end performs a logical operation on an originalsignal and a pilot optical signal separately with a pseudocode signal ofthe current period of time to obtain an encrypted original signal and anencrypted pilot optical signal.

Frequencies of the original signal, the pilot optical signal, and thepseudocode signal are the same or in an integer multiple relationship,and start and end phases of the original signal, the pilot opticalsignal, and the pseudocode signal are the same.

The original signal is a digital sequence signal, also called basebanddata, and may include an ID number. The ID number herein refers to aunique identification code of each transmitting end, and may be binarydigits of 8 bits, 16 bits, 24 bits, 32 bits, or the like. If a photonicInternet of Things has M transmitting ends, a baseband signal of eachtransmitting end is an ID number of the transmitting end. In addition,status of a pseudocode generator of each transmitting end is determinedaccording to both a current time and an ID. If the pseudocode generatoralso has N states, and each state corresponds to one unique pseudocodesignal, in a T1 period of time, a photon transmitter 1 corresponds to astate 1, a photon transmitter 2 corresponds to a state 2, . . . , aphoton transmitter M corresponds to a state N; however, in a T2 periodof time, the photon transmitter 1 corresponds to the state 2, the photontransmitter 2 corresponds to the state 2, . . . , the photon transmitterM corresponds to the state 1; and so on. In this way, it may be ensuredthat in a same period of time, a pseudocode signal generated by eachtransmitting end is different. For a same transmitting end, pseudocodesignals generated in different period of times are also different. Thepilot optical signal is generated by a pilot optical signal generatorand is a group of all-“1” binary digits of 8 bits, 16 bits, 24 bits, 32bits, or the like.

For example, in a T1 time, it is assumed that a baseband signal of atransmitting end 1 is0000000000000000000000000000011011111111111111111111111111111111,totaling 64 bits, where the first 32 bits are an ID number of thetransmitting end 1, that is, 00000000000000000000000000000110; and thelast 32 bits are an all-1 pilot optical signal. In a T1 unit time,status of a pseudocode generator is a state 1, and is assumed to be11101001110100111010001001001101; then, the logical operation thereof,that is, an exclusive OR process, is shown in Table 7.

TABLE 7 Logical operation process of an original signal of atransmitting end 1 in a T1 unit time Original 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 signal Pseudocode 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1 signalOutput 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1 signal Original 0 0 0 0 0 0 0 00 0 0 0 1 1 0 signal Pseudocode 0 1 0 0 0 1 0 0 1 0 0 1 1 0 1 signalOutput 0 1 0 0 0 1 0 0 1 0 0 1 0 1 1 signal

It may be learned from Table 7 that a convoluted output signal, that is,the encrypted original guide signal is 11101001110100111010001001001011.

The logical operation on the pilot optical signal with the pseudocodesignal, which is an exclusive OR process shown in Table 8.

TABLE 8 Logical operation process of a pilot optical signal of atransmitting end 1 in a T1 unit time Pilot 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 optical signal Pseudocode 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1 signalOutput 0 0 0 1 0 1 1 0 0 0 1 0 1 1 0 0 0 signal Pilot 1 1 1 1 1 1 1 1 11 1 1 1 1 1 optical signal Pseudocode 0 1 0 0 0 1 0 0 1 0 0 1 1 0 1signal Output 1 0 1 1 1 0 1 1 0 1 1 0 0 1 0 signal

It may be learned from Table 8 that an output signal after the logicaloperation, that is, the encrypted pilot optical signal is00010110001011000101110110110010.

S504: The transmitting end combines the encrypted original signal andthe encrypted pilot optical signal to obtain the scrambled signal.

For example, an encrypted original signal11101001110100111010001001001011 and an encrypted pilot optical signal00010110001011000101110110110010 are combined to obtain the scrambledsignal 1110100111010011101000100100101100010110001011000101110110110010.Herein, the first 32 bits are an encrypted original signal and the last32 bits are an encrypted pilot optical signal for combination. In aspecific process, it may also be that the first 32 bits are an encryptedpilot optical signal and the last 32 bits are an encrypted originalsignal for combination. Other examples are not described herein one byone.

S505: The transmitting end sends the scrambled signal in the form of avisible light signal.

It is assumed that ID represents an ID signal of the transmitting end,PW represents a pilot optical signal of the transmitting end, and PNrepresents a pseudocode signal; then, the output scrambled signal S maybe represented by S=ID*PN+PW*PN. If a signal transmitted at this momentby the transmitting end is shot for duplication by a high-speed camera,a replicated signal is also1110100111010011101000100100101100010110001011000101110110110010.

S506: The receive and control system receives the visible light signaltransmitted in S505, and converts the visible light signal into adigital signal.

Specifically, a receiving end in the receive and control system receivesthe visible light signal transmitted by the transmitting end, convertsan optical signal into a current signal, converts the current signalinto a voltage signal, and outputs the voltage signal as a digitalsignal.

S507: The receive and control system decomposes the digital signal toobtain the encrypted original signal and the encrypted pilot opticalsignal.

S508: The receive and control system performs a logical operation on theencrypted pilot optical signal with a prestored pseudocode signalcorresponding to a state machine of all users in the current period oftime, and determines a pseudocode signal corresponding to current statusaccording to relevant peaks.

S508 may be implemented by a receiving end that receives the visiblelight signal, and may also be implemented by the system controlplatform.

For example, the receiving ends of the receive and control system, likethe transmitting end, also have a same state machine and status of thestate machine also keeps changing with time. A difference lies in that:each transmitting end in a period of time corresponds only to one state,which changes to another state after this period of time elapses, thatis, only one group of pseudocode signals is generated, and thispseudocode varies with time. However, at the receiving end, Mtransmitting ends exist, that is, M users exist. A receiving and controlend has N states, that is, has N groups of pseudocode signals, and eachgroup of pseudocode signals is different. The N pseudocodes are storedin N registers, and each register corresponds to a unique transmittingend, that is, each register stores an ID of a fixed transmitting end anda pseudocode signal that varies with time, for example, a register 1always stores an ID of a transmitting end 1, and a register 2 alwaysstores an ID of a transmitting end 2. A pseudocode signal stored by eachregister corresponds to a pseudocode signal in the transmitting end oneby one and is determined by time and keeps changing with time. Forexample, in the T1 period of time, the register 1 corresponds to thestate 1, the register 2 corresponds to the state 2, . . . , a register Ncorresponds to a state N; however, in the T2 period of time, theregister 1 corresponds to the state 2, the register 2 corresponds to thestate 2, . . . , the register N corresponds to the state 1; and so on.

The relevant peaks refer to peak values of a group of digital sequencesobtained after the logical operation is performed on the encrypted pilotoptical signal with the pseudocode signal. For example, the encryptedpilot optical signal is a result of an exclusive OR operation of anall-“1” digital sequence with the pseudocode signal. If the encryptedpilot optical signal and a prestored pseudocode signal corresponding toa state machine of all users in the current period of time are traversedfor the exclusive OR operation, and if peak values of the result of theoperation is an all-1 digital sequence, it is proved that a pseudocodesignal corresponding to a state machine of a receiving end in thecurrent period of time is the same as a pseudocode signal correspondingto the state machine of the transmitting end in the current period oftime, so that the pseudocode signal corresponding to the current statusof the receiving end is obtained.

It is assumed that in the T1 period of time, the logical operation isperformed on the encrypted pilot optical signal00010110001011000101110110110010 with pseudocode signals stored by the Nregisters one by one; then, by means of relevant peak recognition, a32-bit all-“1” sequence may be obtained, so that a pseudocode signalused for encryption is obtained, that is, the pseudocode signal storedin the register 1 is 11101001110100111010001001001101.

S509: The receive and control system decrypts the encrypted originalsignal by using the pseudocode signal corresponding to the currentstatus, to obtain an original signal.

For example, the logical operation is performed on the pseudocode signal11101001110100111010001001001101 with encrypted ID data11101001110100111010001001001011 to obtain a decrypted ID data, that is,00000000000000000000000000000110, so that the original signal isobtained.

It is assumed that when the T2 period of time arrives, the basebandsignal of the transmitting end 1 is still0000000000000000000000000000011011111111111111111111111111111111.However, at this moment, the state machine of the transmitting end 1 isin the state 2. If a pseudocode signal corresponding to the state 2 is10101101010100101011001101011010, the logical operation thereof, thatis, an exclusive OR process, is shown in Table 9.

TABLE 9 Logical operation process of an original signal of atransmitting end 1 in a T2 unit time Original 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 signal Pseudocode 1 0 1 0 1 1 0 1 0 1 0 1 0 0 1 0 1 signalOutput 1 0 1 0 1 1 0 1 0 1 0 1 0 0 1 0 1 signal Original 0 0 0 0 0 0 0 00 0 0 0 1 1 0 signal Pseudocode 0 1 1 0 0 1 1 0 1 0 1 1 0 1 0 signalOutput 0 1 1 0 0 1 1 0 1 0 1 1 1 0 0 signal

It may be learned from Table 9 that an output signal after the logicaloperation, that is, the encrypted original signal, is10101101010100101011001101011100.

The logical operation on the pilot optical signal with the pseudocodesignal, which is an exclusive OR process shown in Table 10.

TABLE 10 Logical operation process of a pilot optical signal of atransmitting end 1 in a T2 unit time Pilot 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 optical signal Pseudocode 1 0 1 0 1 1 0 1 0 1 0 1 0 0 1 0 1 signalOutput 0 1 0 1 0 0 1 0 1 0 1 0 1 1 0 1 0 signal Pilot 1 1 1 1 1 1 1 1 11 1 1 1 1 1 optical signal Pseudocode 0 1 1 0 0 1 1 0 1 0 1 1 0 1 0signal Output 1 0 0 1 1 0 0 1 0 1 0 0 1 0 1 signal

It may be learned from Table 10 that an output signal after the logicaloperation, that is, the encrypted pilot optical signal, is01010010101011010100110010100101.

From Table 9 and Table 10, it may be obtained that the pseudocode signaltransmitted by the transmitting end in the T2 unit time is1010110101010010101100110101110001010010101011010100110010100101.

In the T2 period of time, the register 1 of the receiving end stillstores the ID number: 00000000000000000000000000000110. Because a statuschange of the receiving end is the same as that of the transmitting end,status of the register 1 at this moment also synchronously changes tothe state 2, and like the state 2 of the transmitting end, uses thepseudocode signal 10101101010100101011001101011010. According to thereceiving processing procedure and method described above, the receivingend can also identify the pseudocode signal used for encryption, anddecrypted ID data can also be consistent with stored ID data and is alegal signal.

If a signal replicated in the Ti period of time, that is,1110100111010011101000100100101100010110001011000101110110110010, isidentified in the T2 period of time by the receiving end; then, in apseudocode determiner, it can be identified that a used pseudocodesignal is a pseudocode signal used in the state 1, that is,11101001110100111010001001001101, and a register that stores thepseudocode signal is X but not the register 1. Because an ID numberstored by each register is unique, the ID number stored by the registerX cannot be 00000000000000000000000000000110. However, when a pseudocodesignal identified by the pseudocode determiner is used to decrypt an IDof a replicated signal, an obtained ID is00000000000000000000000000000110, that is, an incorrect ID is obtained.Therefore, information replicated in a process of optical signaltransmission cannot be identified by the receiving end in a next periodof time, and becomes expired information, thereby improving security ofa photonic Internet of Things.

In Embodiment 5, for the step in which the transmitting end performs alogical operation on the original signal and the pilot optical signalseparately with the pseudocode signal of the current period of time, theexclusive OR operation is used as an example for description. In aspecific implementation process, another logical operation, for example,a logical AND operation may further be included, which is not describedherein again.

Embodiment 6

Referring to FIG. 6, FIG. 6 is a flowchart of a handshakesynchronization method based on visible light communication according toEmbodiment 6 of the disclosure. The method includes:

S601: A transmitting end in which a state machine varies with unit timeconnects to a system control platform.

Specifically, the state machine of the transmitting end keeps changingwith the unit time. When in a certain period of time, the state machineof the transmitting end is exactly in an N^(th) state. The transmittingend is connected to the system control platform.

By performing this step, the transmitting end and the system controlplatform implements a handshake.

S602: The system control platform adjusts status of a state machine ofthe system control platform and status of a state machine of eachreceiving end connected to the system control platform to be synchronouswith status of the state machine of the transmitting end.

S603: The transmitting end performs a logical operation on an originalsignal and a pilot optical signal separately with a pseudocode signal ofthe current period of time to obtain an encrypted original signal and anencrypted pilot optical signal.

The pseudocode signal varies with the unit time. The pseudocode signalof the current period of time is discarded in a next period of time, anda new pseudocode signal is used. Frequencies of the original signal, thepilot optical signal, and the pseudocode signal are the same or in aninteger multiple relationship, and start and end phases of the originalsignal, the pilot optical signal, and the pseudocode signal are thesame.

S604: The transmitting end combines the encrypted original signal andthe encrypted pilot optical signal to obtain the scrambled signal.

For example, an encrypted original signal11101001110100111010001001001011 and an encrypted pilot optical signal00010110001011000101110110110010 are combined to obtain the scrambledsignal 1110100111010011101000100100101100010110001011000101110110110010.

S605: The transmitting end modulates the scrambled signal to obtain amodulated signal. S606: The transmitting end sends the modulated signalin the form of a visible light signal. For example, the transmitting endsends the modulated signal in a blinking form by using an LED lamp.

S607: The receiving end receives the visible light signal sent by thetransmitting end, and converts the visible light signal into a digitalsignal.

S608: The receiving end demodulates the digital signal to obtain ademodulated signal. S609: The receiving end decomposes the demodulatedsignal to obtain an encrypted original signal and an encrypted pilotoptical signal.

S610: The receiving end performs a convolution operation on theencrypted pilot optical signal with a prestored pseudocode signalcorresponding to a state machine of all users in the current period oftime, and determines a pseudocode signal corresponding to current statusaccording to relevant peaks.

For example, status of a register 1 of the receiving end in a T1 periodof time is a state 1, that is, the pseudocode signal is11101001110100111010001001001101. In this case, the encrypted pilotoptical signal is 00010110001011000101110110110010, and the convolutionoperation is performed on the encrypted pilot optical signal with therandom code. By means of relevant peak recognition, a 32-bit all-“1”sequence may be obtained, which indicates that the pseudocode signal isa pseudocode signal used for encryption. The logical operation on theencrypted pilot optical signal with the pseudocode signal, which is anexclusive OR process shown in Table 11.

TABLE 11 Logical operation process of an encrypted pilot optical signalof a receiving end 1 in a T1 unit time Encrypted 0 0 0 1 0 1 1 0 0 0 1 01 1 0 0 0 pilot optical signal Pseudocode 1 1 1 0 1 0 0 1 1 1 0 1 0 0 11 1 signal Pilot 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 optical signalEncrypted 1 0 1 1 1 0 1 1 0 1 1 0 0 1 0 pilot optical signal Pseudocode0 1 0 0 0 1 0 0 1 0 0 1 1 0 1 signal Pilot 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1optical signal

S611: The receiving end decrypts the encrypted original signal by usingthe pseudocode signal corresponding to the current status, to obtain anoriginal signal.

For example, the logical operation is performed on the encryptedoriginal signal 11101001110100111010001001001011 with the pseudocodesignal 11101001110100111010001001001101, which is an exclusive ORprocess shown in Table 12.

TABLE 12 Logical operation process of an encrypted pilot optical signalof a receiving end 1 in a T1 unit time Encrypted 1 1 1 0 1 0 0 1 1 1 0 10 0 1 1 1 original signal Pseudocode 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1signal Output 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 signal Encrypted 0 1 0 00 1 0 0 1 0 0 1 0 1 1 original signal Pseudocode 0 1 0 0 0 1 0 0 1 0 0 11 0 1 signal Output 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 signal

It may be learned from Table 12 that a decrypted original signal, thatis, an ID signal, is 00000000000000000000000000000110.

S612: The system control platform compares a decrypted original signalwith a prestored original signal of all users, and determines legalityof the received original signal. If the received original signal islegal, perform S613; otherwise, perform S614.

In a specific implementation process, S612 may also be replaced by thefollowing step: The receiving end compares a decrypted original signalwith a prestored original signal, and determines legality of a receivedoriginal signal. For example, the decrypted original signal is00000000000000000000000000000110 and the prestored original signal isalso 00000000000000000000000000000110, it is determined that thereceived original signal is legal.

If a signal replicated in the T1 period of time, that is,1110100111010011101000100100101100010110001011000101110110110010, isidentified in the T2 period of time by the receiving end; then, in apseudocode determiner, it can be identified that a used pseudocodesignal is a pseudocode signal used in the state 1, that is,11101001110100111010001001001101, and a register that stores thepseudocode signal is X but not the register 1. Because an ID numberstored by each register is unique, the ID number stored by the registerX cannot be 00000000000000000000000000000110. However, when a pseudocodesignal identified by the pseudocode determiner is used to decrypt an IDof a replicated signal, an obtained ID is00000000000000000000000000000110, that is, an incorrect ID is obtained.Therefore, if the two signals are different when ID comparison isperformed in an ID determiner, it may be determined that the receivedoriginal signal is an illegal signal.

S613: The receiving end controls an action of a functional unitconnected to the receiving end. For example, the receiving end controlsa door access control system to perform an unlocking action, or controlto power on a household appliance and enter a working state.

S614: The receiving end executes a prompting action, for example, sendsa text prompt or a voice prompt.

In the foregoing synchronization method, even if a visible light signaltransmitted by a transmitting end is shot by a high-speed camera andthen replicated, a replicated signal cannot be synchronous with a statuschange of a receiving end. Therefore, in a different time, even if thereplicated signal is used to attempt to identify the receiving end, itcan be determined that the replicated signal is an illegal signal, sothat security of a photonic Internet of Things can be improved.

The foregoing describes the method embodiments of the disclosure. Thefollowing describes in detail exemplary embodiments of a hardware systemfor running the foregoing method embodiments.

Embodiment 7

Referring to FIG. 7, FIG. 7 is a schematic structural diagram of ahandshake synchronization system based on visible light communicationaccording to Embodiment 7 of the disclosure. The system 700 includes atransmitting end 701 and a receive and control system 702, where thereceive and control system 702 includes a system control platform 703,and at least one receiving end 704 connected to the system controlplatform.

A state machine of the transmitting end 701 varies with unit time, andin a preset period of time, the transmitting end 701 connects to thereceive and control system 702 to implement a handshake. Thetransmitting end 701 includes a pseudocode generator 701 a, a pilotoptical signal generator 701 b, an encoder 701 c, and a light emittingunit 701 d.

The pseudocode generator 701 a is configured to generate and output apseudocode signal which varies with unit time. Working status of thepseudocode generator 701 a varies with the unit time, and the outputpseudocode signal also varies with the unit time. For example, in a T1unit time, the status of the pseudocode generator 701 a is a state 1,and the output pseudocode signal is 11101001110100111010001001001101;and in a T2 period of time, the status of the pseudocode generator 701ais a state 2, and the output pseudocode signal is10101101010100101011001101011010.

The pilot optical signal generator 701 b is configured to output a pilotoptical signal. A frequency of the pilot optical signal generator 701 band a working frequency of the pseudocode generator are the same or inan integer multiple relationship.

The encoder 701 c, which is connected to the pilot optical signalgenerator 701 b and the pseudocode generator 701 a, is configured toperform a logical operation on an original signal and an optical signal,which is output by the pilot optical signal generator 701 b, separatelywith a pseudocode signal output by the pseudocode generator 701 a in thecurrent period of time to obtain an encrypted original signal and anencrypted pilot optical signal. The encrypted original signal and theencrypted pilot optical signal are combined to obtain the scrambledsignal. For example, an encrypted original signal11101001110100111010001001001011 and an encrypted pilot optical signal00010110001011000101110110110010 are combined to obtain the scrambledsignal 1110100111010011101000100100101100010110001011000101110110110010.Herein, the first 32 bits are an encrypted original signal and the last32 bits are an encrypted pilot optical signal for combination. In aspecific process, it may also be that the first 32 bits are an encryptedpilot optical signal and the last 32 bits are an encrypted originalsignal for combination.

The light emitting unit 701 d connected to the encoder 701 c isconfigured to send, in a form (a blinking form) of a visible lightsignal, the scrambled signal output by the encoder 701 c. The sendingunit 701 c may be a light emitting diode, and may also be anothercomponent that has a light emitting function.

The transmitting end 701 may be a dedicated photon client, a mobilephone, or a handheld electronic device that has a function oftransmitting a visible light signal.

The receive and control system 702 includes a system control platform703, and at least one receiving end 704 connected to the system controlplatform 703. The receiving end 704 is synchronous with status of astate machine of the transmitting end in the current period of time.After the state machine of the transmitting end 701 is synchronous witha state machine of the receiving end 704, the status of the statemachine of the receiving end 704 varies with the unit time as the statusof the state machine of the transmitting end 701.

The receiving end 704 includes a receiving unit 702 a, a decomposingunit 702 b, a pseudocode determiner 702 c, and a decoder 702 d.

The receiving unit 702 a receives the visible light signal transmittedby the transmitting end 701 a, and converts the visible light signalinto a digital signal.

The decomposing unit 702 b connected to the receiving unit 702 a isconfigured to decompose the digital signal obtained by conversion by thereceiving unit 702 a to obtain an encrypted original signal and anencrypted pilot optical signal.

The decomposing unit 702 b is connected to the pseudocode determiner 702c. The pseudocode determiner performs a logical operation on theencrypted pilot optical signal with a prestored pseudocode signalcorresponding to a state machine of all users in a photonic Internet ofThings system in the current period of time, for example, after aconvolution operation, determines a pseudocode signal corresponding tocurrent status according to relevant peaks.

The decoder 702 d, which is connected to the decomposing unit 702 b andthe pseudocode determiner 702 c, is configured to use the pseudocodesignal output by the pseudocode determiner 702 c to decrypt theencrypted original signal, which is output by the decomposing unit 702b, to obtain an original signal. In a specific implementation process,the decoder 702 d has a buffering function, which is used to buffer anencrypted original signal output by the decomposing unit 702 b, or abuffering unit is connected between the decomposing unit 702 b and thedecoder 702 d and configured to buffer an encrypted original signaloutput by the decomposing unit 702 b.

In a specific implementation process, an ID determiner connected to thedecoder 702 d, and a specific device connected to the determiner, forexample, a door lock, a household appliance, or the like may further beincluded.

Embodiment 8

Referring to FIG. 8, FIG. 8 is a schematic structural diagram of ahandshake synchronization system for a visible light signal according toEmbodiment 8 of the disclosure. Compared with Embodiment 7, thetransmitting end 701 further includes:

a modulator 701 e, connected between the encoder 701 c and the sendingunit 701 d, and configured to modulate the scrambled signal.

Correspondingly, the receiving end 702 further includes:

a demodulator 702 e, connected between the receiving unit 702 a and thedecomposing unit 702 b, and configured to demodulate the digital signaloutput by the receiving unit 702 a.

Embodiment 9

Referring to FIG. 9, FIG. 9 is a schematic structural diagram of ahandshake synchronization system for a visible light signal according toEmbodiment 9 of the disclosure. Compared with Embodiment 8, thereceiving end 702 further includes:

an original signal determiner 702 f, connected to the decoder 702 d andthe pseudocode determiner 702 c, and configured to compare a decryptedoriginal signal with an original signal prestored in the pseudocodedeterminer and determine legality of a received original signal. In aspecific implementation process, the original signal determiner 702 fhas a buffering function, which is used to buffer an original signaloutput by the pseudocode determiner 702 c, or a buffer may be connectedbetween the pseudocode determiner 702 c and the original signaldeterminer 702 f, and the original signal output by the pseudocodedeterminer 702 c by using the buffer.

In a specific implementation process, the synchronization system 700further includes a functional unit connected to the receiving unit 702a, for example, an electric lock, or the like.

Embodiment 10

Referring to FIG. 10, FIG. 10 is a flowchart of a handshakesynchronization restoration method according to Embodiment 10 of thedisclosure. The handshake synchronization restoration method includes:

S1001: A transmitting end in which a state machine varies with unit timeencounters power outage and is powered on again.

S1002: The transmitting end sends, in a blinking form, a status resetsignal varying with unit time to a receive and control system.

The status reset signal is formed by three parts: a status reset code, astatus indication code, and an original signal (for example, an ID). Thereset code has a unique value, and has a same length as a pilot opticalsignal. The status indication code is a random number, and used toinstruct a photon receiving end to use a pseudocode sequence of whichstate. The status reset signal, after being modulated by a modulator, istransmitted by an LED.

S1003: The receive and control system receives a visible light signaltransmitted by the transmitting end.

S1004: When determining that the received visible light signal is astatus reset signal, the receive and control system adjusts status of astate machine to a state indicated by the status reset signal.

S1005: The transmitting end adjusts status of the state machine to astate indicated by the status reset signal.

S1004 and S1005 occur at the same time.

Specifically, the receive and control system determines whether thevisible light signal is a status reset signal by using a status resetdeterminer; and if yes, splits the status indication code from the ID,and resets status of a register, corresponding to an ID number, in apseudocode determiner to a state indicated by the status indicationcode.

Hereto, handshake synchronization is restored between the transmittingend and the receive and control system. Then, pseudocode generators ofboth sides make a same change along with time. The status indicationcode is a random number, which is random, and only indicates a stateused when status of the transmitting end and the receive and controlsystem are reset. Therefore, even if this status code is obtained byshooting by a high-speed camera, a pseudocode sequence in use cannot beobtained. When status reset is performed for the next time, the statusindication code changes to another value, and the pseudocode sequence inuse also changes accordingly. Therefore, a signal replicated by shootingby the high-speed camera becomes invalid, thereby improving security ofa photonic Internet of Things.

Embodiment 11

Referring to FIG. 11, FIG. 11 is a flowchart of a handshakesynchronization restoration method provided by Embodiment 11 of thedisclosure. The handshake synchronization restoration method includes:

S1101: A transmitting end in which a state machine varies with unit timeconnects to a receive and control system.

By performing this step, the transmitting end and the receive andcontrol system implements a handshake.

The receive and control system includes a system control platform, andeach receiving end connected to the system control platform.

Specifically, the state machine of the transmitting end keeps changingwith the unit time. When in a certain period of time, the state machineof the transmitting end is exactly in an N^(th) state. The transmittingend is connected to the system control platform.

S1102: The receive and control system adjusts status of a state machineof each receiving end to be synchronous with status of the state machineof the transmitting end.

Specifically, the system control platform adjusts status of a statemachine of the system control platform and the status of the statemachine of each receiving end to be synchronous with the status of thestate machine of the transmitting end, for example, to be in the N^(th)state.

S1103: The transmitting end performs a logical operation on an originalsignal and a pilot optical signal separately with a pseudocode signal ofthe current period of time to obtain an encrypted original signal and anencrypted pilot optical signal.

Frequencies of the original signal, the pilot optical signal, and thepseudocode signal are the same or in an integer multiple relationship,and start and end phases of the original signal, the pilot opticalsignal, and the pseudocode signal are the same.

The original signal is a digital sequence signal, also called basebanddata, and may include an ID number. The ID number herein refers to aunique identification code of each transmitting end, and may be binarydigits of 8 bits, 16 bits, 24 bits, 32 bits, or the like. If a photonicInternet of Things has M transmitting ends, a baseband signal of eachtransmitting end is an ID number of the transmitting end. In addition,status of a pseudocode generator of each transmitting end is determinedaccording to both a current time and an ID. If the pseudocode generatoralso has N states, and each state corresponds to one unique pseudocodesignal, in a T1 period of time, a photon transmitter 1 corresponds to astate 1, a photon transmitter 2 corresponds to a state 2, . . . , aphoton transmitter M corresponds to a state N; however, in a T2 periodof time, the photon transmitter 1 corresponds to the state 2, the photontransmitter 2 corresponds to the state 2, . . . , the photon transmitterM corresponds to the state 1; and so on. In this way, it may be ensuredthat in a same period of time, a pseudocode signal generated by eachtransmitting end is different. For a same transmitting end, pseudocodesignals generated in different period of times are also different. Thepilot optical signal is generated by a pilot optical signal generatorand is a group of all-“1” binary digits of 8 bits, 16 bits, 24 bits, 32bits, or the like.

For example, in a T1 time, it is assumed that a baseband signal of atransmitting end 1 is0000000000000000000000000000011011111111111111111111111111111111,totaling 64 bits, where the first 32 bits are an ID number of thetransmitting end 1, that is, 00000000000000000000000000000110; and thelast 32 bits are an all-1 pilot optical signal. In a T1 unit time,status of a pseudocode generator is a state 1, and is assumed to be11101001110100111010001001001101; then, the logical operation thereof,that is, an exclusive OR process, is shown in Table 13.

TABLE 13 Logical operation process of an original signal of atransmitting end 1 in a T1 unit time Original 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 signal Pseudocode 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1 signalOutput 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1 signal Original 0 0 0 0 0 0 0 00 0 0 0 1 1 0 signal Pseudocode 0 1 0 0 0 1 0 0 1 0 0 1 1 0 1 signalOutput 0 1 0 0 0 1 0 0 1 0 0 1 0 1 1 signal

It may be learned from Table 13 that a convoluted output signal, thatis, the encrypted original guide signal is11101001110100111010001001001011.

The logical operation on the pilot optical signal with the pseudocodesignal, which is an exclusive OR process shown in Table 14.

TABLE 14 Logical operation process of a pilot optical signal of atransmitting end 1 in a T1 unit time Pilot 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 optical signal Pseudocode 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1 signalOutput 0 0 0 1 0 1 1 0 0 0 1 0 1 1 0 0 0 signal Pilot 1 1 1 1 1 1 1 1 11 1 1 1 1 1 optical signal Pseudocode 0 1 0 0 0 1 0 0 1 0 0 1 1 0 1signal Output 1 0 1 1 1 0 1 1 0 1 1 0 0 1 0 signal

It may be learned from Table 14 that an output signal after the logicaloperation, that is, the encrypted pilot optical signal is00010110001011000101110110110010.

S1104: The transmitting end combines the encrypted original signal andthe encrypted pilot optical signal to obtain the scrambled signal.

For example, an encrypted original signal11101001110100111010001001001011 and an encrypted pilot optical signal00010110001011000101110110110010 are combined to obtain the scrambledsignal 1110100111010011101000100100101100010110001011000101110110110010.Herein, the first 32 bits are an encrypted original signal and the last32 bits are an encrypted pilot optical signal for combination. In aspecific process, it may also be that the first 32 bits are an encryptedpilot optical signal and the last 32 bits are an encrypted originalsignal for combination. Other examples are not described herein one byone.

S1105: The transmitting end sends the scrambled signal in the form of avisible light signal.

It is assumed that ID represents an ID signal of the transmitting end,PW represents a pilot optical signal of the transmitting end, and PNrepresents a pseudocode signal; then, the output scrambled signal S maybe represented by S=ID*PN+PW*PN. If a signal transmitted at this momentby the transmitting end is shot for duplication by a high-speed camera,a replicated signal is also1110100111010011101000100100101100010110001011000101110110110010.

S1106: The receive and control system receives the visible light signaltransmitted in S1105, and converts the visible light signal into adigital signal.

Specifically, a receiving end in the receive and control system receivesthe visible light signal transmitted by the transmitting end, convertsan optical signal into a current signal, converts the current signalinto a voltage signal, and outputs the voltage signal as a digitalsignal.

S1107: The receive and control system decomposes the digital signal toobtain the encrypted original signal and the encrypted pilot opticalsignal.

S1108: The receive and control system performs a logical operation onthe encrypted pilot optical signal with a prestored pseudocode signalcorresponding to a state machine of all users in the current period oftime, and determines a pseudocode signal corresponding to current statusaccording to relevant peaks.

S1108 may be implemented by a receiving end that receives the visiblelight signal, and may also be implemented by the system controlplatform.

For example, receiving ends of the receive and control system, like thetransmitting end, also have a same state machine and status of the statemachine also keeps changing with time. A difference lies in that: eachtransmitting end in a period of time corresponds only to one state,which changes to another state after this period of time elapses, thatis, only one group of pseudocode signals is generated, and thispseudocode varies with time. However, at the receiving end, Mtransmitting ends exist, that is, M users exist. A receiving and controlend has N states, that is, has N groups of pseudocode signals, and eachgroup of pseudocode signals is different. The N pseudocodes are storedin N registers, and each register corresponds to a unique transmittingend, that is, each register stores an ID of a fixed transmitting end anda pseudocode signal that varies with time, for example, a register 1always stores an ID of a transmitting end 1, and a register 2 alwaysstores an ID of a transmitting end 2. A pseudocode signal stored by eachregister corresponds to a pseudocode signal in the transmitting end oneby one and is determined by time and keeps changing with time. Forexample, in the T1 period of time, the register 1 corresponds to thestate 1, the register 2 corresponds to the state 2, . . . , a register Ncorresponds to a state N; however, in the T2 period of time, theregister 1 corresponds to the state 2, the register 2 corresponds to thestate 2, . . . , the register N corresponds to the state 1; and so on.

The relevant peaks refers to peak values of a group of digital sequencesobtained after the logical operation on the encrypted pilot opticalsignal with the pseudocode signal. For example, the encrypted pilotoptical signal is a result of an exclusive OR operation of an all-“1”digital sequence with the pseudocode signal. If the encrypted pilotoptical signal and a prestored pseudocode signal corresponding to astate machine of all users in the current period of time are traversedfor the exclusive OR operation, and if peak values of the result of theoperation is an all-1 digital sequence, it is proved that a pseudocodesignal corresponding to a state machine of a receiving end in thecurrent period of time is the same as a pseudocode signal correspondingto the state machine of the transmitting end in the current period oftime, so that the pseudocode signal corresponding to the current statusof the receiving end is obtained.

It is assumed that in the T1 period of time, the logical operation isperformed on the encrypted pilot optical signal00010110001011000101110110110010 with pseudocode signals stored by the Nregisters one by one; then, by means of relevant peak recognition, a32-bit all-“1” sequence may be obtained, so that a pseudocode signalused for encryption is obtained, that is, the pseudocode signal storedin the register 1 is 11101001110100111010001001001101.

S1109: The receive and control system decrypts the encrypted originalsignal by using the pseudocode signal corresponding to the currentstatus, to obtain an original signal.

For example, the logical operation is performed on the pseudocode signal11101001110100111010001001001101 with encrypted ID data11101001110100111010001001001011 to obtain a decrypted ID data, that is,00000000000000000000000000000110, so that the original signal isobtained.

It is assumed that when the T2 period of time arrives, the basebandsignal of the transmitting end 1 is still0000000000000000000000000000011011111111111111111111111111111111.However, at this moment, the state machine of the transmitting end 1 isin the state 2. If a pseudocode signal corresponding to the state 2 is10101101010100101011001101011010, the logical operation thereof, thatis, an exclusive OR process, is shown in Table 15.

TABLE 15 Logical operation process of an original signal of atransmitting end 1 in a T2 unit time Original 0 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0 signal Pseudocode 1 0 1 0 1 1 0 1 0 1 0 1 0 0 1 0 1 signalOutput 1 0 1 0 1 1 0 1 0 1 0 1 0 0 1 0 1 signal Original 0 0 0 0 0 0 0 00 0 0 0 1 1 0 signal Pseudocode 0 1 1 0 0 1 1 0 1 0 1 1 0 1 0 signalOutput 0 1 1 0 0 1 1 0 1 0 1 1 1 0 0 signal

It may be learned from Table 15 that an output signal after the logicaloperation, that is, the encrypted original signal is10101101010100101011001101011100.

The logical operation on the pilot optical signal with the pseudocodesignal, which is an exclusive OR process shown in Table 16.

TABLE 16 Logical operation process of a pilot optical signal of atransmitting end 1 in a T2 unit time Pilot 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 optical signal Pseudocode 1 0 1 0 1 1 0 1 0 1 0 1 0 0 1 0 1 signalOutput 0 1 0 1 0 0 1 0 1 0 1 0 1 1 0 1 0 signal Pilot 1 1 1 1 1 1 1 1 11 1 1 1 1 1 optical signal Pseudocode 0 1 1 0 0 1 1 0 1 0 1 1 0 1 0signal Output 1 0 0 1 1 0 0 1 0 1 0 0 1 0 1 signal

It may be learned from Table 16 that an output signal after the logicaloperation, that is, the encrypted pilot optical signal is01010010101011010100110010100101.

From Table 15 and Table 16, it may be obtained that the pseudocodesignal transmitted by the transmitting end in the T2 unit time is1010110101010010101100110101110001010010101011010100110010100101.

In the T2 period of time, the register 1 of the receiving end stillstores the ID number: 00000000000000000000000000000110. Because a statuschange of the receiving end is the same as that of the transmitting end,status of the register 1 at this moment also synchronously changes tothe state 2, and like the state 2 of the transmitting end, uses thepseudocode signal 10101101010100101011001101011010. According to thereceiving processing procedure and method described above, the receivingend can also identify the pseudocode signal used for encryption, anddecrypted ID data can also be consistent with stored ID data and is alegal signal.

If a signal replicated in the T1 period of time, that is,1110100111010011101000100100101100010110001011000101110110110010, isidentified in the T2 period of time by the receiving end; then, in apseudocode determiner, it can be identified that a used pseudocodesignal is a pseudocode signal used in the state 1, that is,11101001110100111010001001001101, and a register that stores thepseudocode signal is X but not the register 1. Because an ID numberstored by each register is unique, the ID number stored by the registerX cannot be 00000000000000000000000000000110. However, when a pseudocodesignal identified by the pseudocode determiner is used to decrypt an IDof a replicated signal, an obtained ID is00000000000000000000000000000110, that is, an incorrect ID is obtained.Therefore, information replicated in a process of optical signaltransmission cannot be identified by the receiving end in a next periodof time, and becomes expired information, thereby improving security ofa photonic Internet of Things.

S1010: After encountering power outage and being powered on again, thetransmitting end sends, in a blinking form, a status reset signalvarying with unit time to the receive and control system.

The status reset signal is formed by three parts: a status reset code, astatus indication code, and an original signal (for example, an ID). Thereset code has a unique value, and has a same length as a pilot opticalsignal. The status indication code is a random number, and used toinstruct a photon receiving end to use a pseudocode sequence of whichstate. The status reset signal, after being modulated by a modulator, istransmitted by an LED.

S1011: When determining that the received visible light signal is astatus reset signal, the receive and control system adjusts status of astate machine to a state indicated by the status reset signal. At thesame time, the transmitting end adjusts the status of the state machineto the state indicated by the status reset signal, and returns to S1103.

In this embodiment, for the step in which the transmitting end performsa logical operation on the original signal and the pilot optical signalseparately with the pseudocode signal of the current period of time, theexclusive OR operation is used as an example for description. In aspecific implementation process, another logical operation, for example,a logical AND operation may further be included, which is not describedherein again.

Embodiment 12

Referring to FIG. 12, FIG. 12 is a flowchart of a handshakesynchronization method based on visible light communication according toEmbodiment 12 of the disclosure. The method includes:

S1201: A transmitting end in which a state machine varies with unit timeconnects to a system control platform.

Specifically, the state machine of the transmitting end keeps changingwith the unit time. When in a certain period of time, the state machineof the transmitting end is exactly in an N^(th) state. The transmittingend is connected to the system control platform.

By performing this step, the transmitting end and the system controlplatform implements a handshake.

S1202: The system control platform adjusts status of a state machine ofthe system control platform and status of a state machine of eachreceiving end connected to the system control platform to be synchronouswith status of the state machine of the transmitting end.

S1203: The transmitting end performs a logical operation on an originalsignal and a pilot optical signal separately with a pseudocode signal ofthe current period of time to obtain an encrypted original signal and anencrypted pilot optical signal.

The pseudocode signal varies with the unit time. The pseudocode signalof the current period of time is discarded in a next period of time, anda new pseudocode signal is used. Frequencies of the original signal, thepilot optical signal, and the pseudocode signal are the same or in aninteger multiple relationship, and start and end phases of the originalsignal, the pilot optical signal, and the pseudocode signal are thesame.

S1204: The transmitting end combines the encrypted original signal andthe encrypted pilot optical signal to obtain the scrambled signal.

For example, an encrypted original signal11101001110100111010001001001011 and an encrypted pilot optical signal00010110001011000101110110110010 are combined to obtain the scrambledsignal 1110100111010011101000100100101100010110001011000101110110110010.

S1205: The transmitting end modulates the scrambled signal to obtain amodulated signal. S1206: The transmitting end sends the modulated signalin the form of a visible light signal. For example, the transmitting endsends the modulated signal in a blinking form by using an LED lamp.

S1207: The receiving end receives the visible light signal sent by thetransmitting end, and converts the visible light signal into a digitalsignal.

S1208: The receiving end demodulates the digital signal to obtain ademodulated signal. S1209: The receiving end decomposes the demodulatedsignal to obtain an encrypted original signal and an encrypted pilotoptical signal.

S1210: The receiving end performs a convolution operation on theencrypted pilot optical signal with a prestored pseudocode signalcorresponding to a state machine of all users in the current period oftime, and determines a pseudocode signal corresponding to current statusaccording to relevant peaks.

For example, status of a register 1 of the receiving end in a T1 periodof time is a state 1, that is, the pseudocode signal is11101001110100111010001001001101. In this case, the encrypted pilotoptical signal is 00010110001011000101110110110010, and the convolutionoperation is performed on the encrypted pilot optical signal with therandom code. By means of relevant peak recognition, a 32-bit all-“1”sequence may be obtained, which indicates that the pseudocode signal isa pseudocode signal used for encryption. The logical operation on theencrypted pilot optical signal with the pseudocode signal, which is anexclusive OR process shown in Table 17.

TABLE 17 Logical operation process of an encrypted pilot optical signalof a receiving end 1 in a T1 unit time Encrypted 0 0 0 1 0 1 1 0 0 0 1 01 1 0 0 0 pilot optical signal Pseudocode 1 1 1 0 1 0 0 1 1 1 0 1 0 0 11 1 signal Pilot 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 optical signalEncrypted 1 0 1 1 1 0 1 1 0 1 1 0 0 1 0 pilot optical signal Pseudocode0 1 0 0 0 1 0 0 1 0 0 1 1 0 1 signal Pilot 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1optical signal

S1211: The receiving end decrypts the encrypted original signal by usingthe pseudocode signal corresponding to the current status, to obtain anoriginal signal.

For example, the logical operation is performed on the encryptedoriginal signal 11101001110100111010001001001011 with the pseudocodesignal 11101001110100111010001001001101, which is an exclusive ORprocess shown in Table 18.

TABLE 18 Logical operation process of an encrypted pilot optical signalof a receiving end 1 in a T1 unit time Encrypted 1 1 1 0 1 0 0 1 1 1 0 10 0 1 1 1 original signal Pseudocode 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1signal Output 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 signal Encrypted 0 1 0 00 1 0 0 1 0 0 1 0 1 1 original signal Pseudocode 0 1 0 0 0 1 0 0 1 0 0 11 0 1 signal Output 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 signal

It may be learned from Table 18 that the decrypted original signal, thatis, an ID signal, is 00000000000000000000000000000110.

S1212: The system control platform compares a decrypted original signalwith a prestored original signal of all users, and determines legalityof a received original signal. If the received original signal is legal,perform S1214; otherwise, perform S1213.

In a specific implementation process, S1212 may also be replaced by thefollowing step: The receiving end compares a decrypted original signalwith a prestored original signal, and determines legality of a receivedoriginal signal. For example, the decrypted original signal is00000000000000000000000000000110 and the prestored original signal isalso 00000000000000000000000000000110, it is determined that thereceived original signal is legal.

If a signal replicated in the T1 period of time, that is,1110100111010011101000100100101100010110001011000101110110110010, isidentified in the T2 period of time by the receiving end; then, in apseudocode determiner, it can be identified that a used pseudocodesignal is a pseudocode signal used in the state 1, that is,11101001110100111010001001001101, and a register that stores thepseudocode signal is X but not the register 1. Because an ID numberstored by each register is unique, the ID number stored by the registerX cannot be 00000000000000000000000000000110. However, when a pseudocodesignal identified by the pseudocode determiner is used to decrypt an IDof a replicated signal, an obtained ID is00000000000000000000000000000110, that is, an incorrect ID is obtained.Therefore, if the two signals are different when ID comparison isperformed in an ID determiner, it may be determined that the receivedoriginal signal is an illegal signal.

S1213: The receiving end executes a prompting action, for example, sendsa text prompt or a voice prompt.

S1214: The receiving end controls an action of a functional unitconnected to the receiving end. For example, the receiving end controlsa door access control system to perform an unlocking action, or controlto power on a household appliance and enter a working state.

S1215: After encountering power outage and being powered on again, thetransmitting end sends, in a blinking form, a status reset signalvarying with unit time to the receive and control system.

The status reset signal is formed by three parts: a status reset code, astatus indication code, and an original signal (for example, an IDnumber). The reset code has a unique value, and has a same length as apilot optical signal. The status indication code is a random number, andused to instruct a photon receiving end to use a pseudocode sequence ofwhich state. The status reset signal, after being modulated by amodulator, is transmitted by an LED.

S1216: When determining that the received visible light signal is astatus reset signal, the receive and control system adjusts status of astate machine to a state indicated by the status reset signal. At thesame time, the transmitting end adjusts the status of the state machineto the state indicated by the status reset signal, and returns to S1203.

In the foregoing synchronization method, the status indication code is arandom number, which is random, and only indicates a state used whenstatus of the transmitting end and the receive and control system arereset. Therefore, even if this status code is obtained by shooting by ahigh-speed camera, a pseudocode sequence in use cannot be obtained. Whenstatus reset is performed for the next time, the status indication codechanges to another value, and the pseudocode sequence in use alsochanges accordingly. Therefore, a signal replicated by shooting by thehigh-speed camera becomes invalid, thereby improving security of aphotonic Internet of Things.

The foregoing describes the method embodiments of the disclosure. Thefollowing describes in detail exemplary embodiments of a hardware systemfor running the foregoing method embodiments.

Embodiment 13

Referring to FIG. 13, FIG. 13 is a schematic structural diagram of ahandshake synchronization restoration system according to Embodiment 13of the disclosure. The system 1300 includes a transmitting end 1301 anda receive and control system 1302, where the receive and control system1302 includes a system control platform 1303, and at least one receivingend 1304 connected to the system control platform.

A state machine of the transmitting end 1301 varies with unit time, andin a preset period of time, the transmitting end 1301 connects to thereceive and control system 1302 to implement a handshake. Thetransmitting end 1301 includes a pseudocode generator 1301 a, a pilotoptical signal generator 1301 b, an encoder 1301 c, a light emittingunit 1301 d, and a status reset unit 1301 e.

The pseudocode generator 1301 a is configured to generate and output apseudocode signal which varies with unit time. Working status of thepseudocode generator 1301 a varies with the unit time, and the outputpseudocode signal also varies with the unit time. For example, in a T1unit time, the status of the pseudocode generator 1301 a is a state 1,and the output pseudocode signal is 11101001110100111010001001001101;and in a T2 period of time, the status of the pseudocode generator 301 ais a state 2, and the output pseudocode signal is10101101010100101011001101011010.

The pilot optical signal generator 1301 b is configured to output apilot optical signal. A frequency of the pilot optical signal generator1301 b and a working frequency of the pseudocode generator are the sameor in an integer multiple relationship.

The encoder 1301 c, which is connected to the pilot optical signalgenerator 1301 b and the pseudocode generator 1301 a, is configured toperform a logical operation on an original signal and an optical signal,which is output by the pilot optical signal generator 1301 b, separatelywith a pseudocode signal output by the pseudocode generator 1301 a inthe current period of time to obtain an encrypted original signal and anencrypted pilot optical signal. The encrypted original signal and theencrypted pilot optical signal are combined to obtain the scrambledsignal. For example, an encrypted original signal11101001110100111010001001001011 and an encrypted pilot optical signal00010110001011000101110110110010 are combined to obtain the scrambledsignal 1110100111010011101000100100101100010110001011000101110110110010.Herein, the first 32 bits are an encrypted original signal and the last32 bits are an encrypted pilot optical signal for combination. In aspecific process, it may also be that the first 32 bits are an encryptedpilot optical signal and the last 32 bits are an encrypted originalsignal for combination.

The light emitting unit 1301 d connected to the encoder 1301 c isconfigured to send, in the form of a visible light signal, the scrambledsignal output by the encoder 1301 c. The sending unit 1301 c may be alight emitting diode, and may also be another component that has a lightemitting function.

The status reset unit 1301 e, which is connected to the pseudocodegenerator 1301 a and the light emitting unit 1301 d, is configured to,after the transmitting end 1301 encounters power outage and is poweredon again, transmit, by using the light emitting unit 1301 d, to thereceive and control system, a status reset signal which varies with unittime; and at the same time, sends a status indication signal to thepseudocode generator 1301 a to instruct the pseudocode generator to usea pseudocode sequence corresponding to which state in the current periodof time. The status reset signal includes: a status reset code, a statusindication code, and an original signal (for example, an ID number). Thereset code has a unique value, and has a same length as a pilot opticalsignal. The status indication signal is a random number, and isconsistent with the status indication code in the status reset signalsent to the receiving end. Therefore, when the transmitting endencounters power outage and is powered on again, status of thetransmitting end may be a state X, and a pseudocode sequence used forencryption also may be the pseudocode sequence corresponding to thestate X.

The transmitting end 1301 may be a dedicated photon client or mobilephone, or another handheld electronic device that has a function oftransmitting a visible light signal.

The receiving end 1304 is synchronous with status of a state machine ofthe transmitting end in the current period of time. After the statemachine of the transmitting end 1301 is synchronous with a state machineof the receiving end 1304, the status of the state machine of thereceiving end 1301 varies with the unit time as the status of the statemachine of the transmitting end 1301.

The receiving end 1304 includes a receiving unit 1302 a, a status resetdeterminer 1302 b, a pseudocode determiner 1302 c, and a decoder 1302 d.

The receiving unit 1302 a receives the visible light signal transmittedby the transmitting end 1301, and converts the visible light signal intoa digital signal.

The status reset determiner 1302 b connected to the receiving unit 1302a is configured to decompose the digital signal, which is obtainedthrough conversion by the receiving unit, into a reset code part, astatus indication code part, and an ID part, and compares the reset codewith a set specific value; and when a condition is matched, determinethat the received visible light signal is a status reset signal, andoutput, to the pseudocode determiner 1302 c, an instruction foradjusting status of a state machine to a state indicated by the statusreset signal. The instruction herein includes a status indication codepart and an ID part; and when the condition is not matched, theencrypted pilot optical signal and the encrypted original signal areoutput.

The pseudocode determiner 1302 c connected to the status resetdeterminer 1302 b is configured to, when an instruction sent by thestatus reset determiner 1302 b is received, adjusts the status of thestate machine to a state indicated by the instruction. When theencrypted pilot optical signal is received, the pseudocode determinerperforms a logical operation on the encrypted pilot optical signal witha prestored pseudocode signal corresponding to a state machine of allusers in a photonic Internet of Things system in the current period oftime, for example, after a convolution operation, determines apseudocode signal corresponding to current status according to relevantpeaks.

The decoder 1302 d, which is connected to the status reset determiner1302 b and the pseudocode determiner 1302 c, is configured to use thepseudocode signal output by the pseudocode determiner 1302 c to decryptthe encrypted original signal, which is output by the status resetdeterminer 1302 b, to obtain an original signal. In a specificimplementation process, the decoder 1302 d has a buffering function,which is used to buffer the encrypted original signal output by thedecomposing unit 1302 b, or a buffering unit is connected between thedecomposing unit 1302 b and the decoder 1302 d and configured to bufferthe encrypted original signal output by the status reset determiner 1302b.

In a specific implementation process, an ID determiner connected to thedecoder 1302 d, and a specific device connected to the determiner, forexample, a door lock, a household appliance, or the like may further beincluded.

Embodiment 14

Referring to FIG. 14, FIG. 14 is a schematic structural diagram of ahandshake synchronization restoration system according to Embodiment 14of the disclosure. Compared with Embodiment 13, the transmitting end1301 further includes:

a modulator 1301 f, connected between the encoder 1301 c and the sendingunit 1301 d, and configured to modulate the scrambled signal.

Correspondingly, the receiving end 1302 further includes:

a demodulator 1302 e, connected between the receiving unit 1302 a andthe status reset determiner 1302 b, and configured to demodulate thedigital signal output by the receiving unit 1302 a.

Further, the receiving end 1302 further includes:

an original signal determiner 1302 f, connected to the decoder 1302 dand the pseudocode determiner 1302 c, and configured to compare adecrypted original signal with an original signal prestored in thepseudocode determiner and determine legality of a received originalsignal. In a specific implementation process, the original signaldeterminer 1302 f has a buffering function, which is used to buffer anoriginal signal output by the pseudocode determiner 1302 c, or a buffermay be connected between the pseudocode determiner 1302 c and theoriginal signal determiner 1302 f, and the original signal output by thepseudocode determiner 1302 c by using the buffer.

In a specific implementation process, the synchronization system 1300further includes a functional unit connected to the receiving unit 1302a, for example, an electric lock, or the like.

Embodiment 15

Referring to FIG. 15, FIG. 15 is a schematic structural diagram of ahandshake synchronization restoration system according to Embodiment 15of the disclosure. The system 1500 includes a transmitting end 1501 anda receive and control system 1502. The transmitting end 1501 includes apseudocode generator 1501 a, a first pilot optical signal generator 1501b, a second pilot optical signal generator 1501 c, an encoder 1501 d,and a light emitting unit 1501 e. The receive and control system 1502includes a system control platform 1503, and at least one receiving end1504 connected to the system control platform 1503.

The pseudocode generator 1501 a is configured to generate and output apseudocode signal that varies with a pilot optical signal 1. Workingstatus of the pseudocode generator 1501 a varies with the pilot opticalsignal 1, and the output pseudocode signal also varies with the pilotoptical signal 1. For example, when the pilot optical signal 1 is00000001, the status of the pseudocode generator 1501 a is a state 1,and the output pseudocode signal is 11101001110100111010001001001101;and when the pilot optical signal 1 is 00000002, the status of thepseudocode generator 1501 a is a state 2, and the output pseudocodesignal is 10101101010100101011001101011010.

The first pilot optical signal generator 1501 b is configured togenerate and output the pilot optical signal 1 that varies with time,where the pilot optical signal 1 is a binary number of multiple bits,for example, a 8-bit binary number: 00000001.

The second pilot optical signal generator 1501 c is configured togenerate and output a pilot optical signal 2 that varies with time,where the pilot optical signal 2 is large numbers in ascending order orin descending order, and the large numbers are not cyclic in a presetperiod of time, for example, does not in 20 years.

The encoder 1501 d, which is connected to the first pilot optical signalgenerator 1501 b, the second pilot optical signal generator 1501 c, andthe pseudocode generator 1501 a, is configured to perform a logicaloperation on an original signal and a pilot optical signal, which isoutput by the first pilot optical signal generator 1501 b and the secondpilot optical signal generator 1501 c, separately with a pseudocodesignal output by the pseudocode generator 1501 a in the current periodof time to obtain an encrypted original signal and an encrypted pilotoptical signal; and combines the encrypted original signal and theencrypted pilot optical signal to obtain the scrambled signal. Forexample, an encrypted original signal 11101001110100111010001001001011is combined with a first encrypted pilot optical signal 00010110 and asecond encrypted pilot optical signal 001011000101110110110010 to obtainthe scrambled signal:

1110100111010011101000100100101100010110001011000101110110110010.

Herein, the first 32 bits are an encrypted original signal and the last32 bits are a first encrypted pilot optical signal and a secondencrypted pilot optical signal for combination. In a specific process,it may also be that the first 32 bits are an encrypted pilot opticalsignal and the last 32 bits are an encrypted original signal.

The light emitting unit 1501 e connected to the encoder 1501 d isconfigured to send, in the form of a visible light signal, the scrambledsignal output by the encoder 1501 d. The light emitting unit 1501 e maybe a light emitting diode, and may also be another component that has alight emitting function.

The transmitting end 1501 may be a dedicated photon client, a mobilephone, or another handheld electronic device that has a function oftransmitting a visible light signal.

The receiving end 1504 includes a receiving unit 1502 a, a pseudocodedeterminer 1502 b, a large number determiner 1502 c, and a decoder 1502d.

The receiving unit 1502 a receives the visible light signal transmittedby the transmitting end 1501, and converts the visible light signal intoa digital signal.

The pseudocode determiner 1502 b connected to the receiving unit 1502 ais configured to decompose the digital signal, which is obtained throughconversion by the receiving unit 1302 a, into an encrypted originalsignal and an encrypted pilot optical signal. When an encrypted pilotoptical signal is received, this pseudocode determiner performs alogical operation on the encrypted pilot optical signal with a prestoredpseudocode signal corresponding to a state machine of all users in aphotonic Internet of Things system in the current period of time, forexample, after convolution operation, determines a pseudocode signalcorresponding to current status according to a decrypted pilot opticalsignal 1; if the decrypted pilot optical signal 1 is consistent withstatus of a current pseudocode signal, proceeds to work; otherwise,reports an error and exits.

The large number determiner 1502 c, which is connected to the receivingunit 1502 a and the pseudocode determiner 1502 b, is configured to usethe pseudocode signal output by the pseudocode determiner 1502 b todecrypt the encrypted pilot optical signal output by the 1502 a toobtain a decrypted pilot optical signal 2, compare the pilot opticalsignal 2 with a large number in the large number determiner 1502 c; ifthe decrypted pilot optical signal 2 is greater than the large number inthe current 1502 c, save the decrypted pilot optical signal 2, andproceed to work; otherwise, report an error and exit.

The decoder 1502 d, which is connected to the receiving unit 1502 a, thepseudocode determiner 1502 b, and the large number determiner 1502 c, isconfigured to use the pseudocode signal output by the pseudocodedeterminer 1502 c to decrypt the encrypted original signal output by the1502 a to obtain an original signal. In a specific implementationprocess, the decoder 1502 d has a buffering function, which is used tobuffer an encrypted original signal output by the decomposing unit 1502a.

In a specific implementation process, an ID determiner connected to thedecoder 1502 d, and a specific device connected to the determiner, forexample, a door lock, a household appliance, or the like may further beincluded.

The foregoing describes the embodiments of the disclosure in detail. Inthis specification, specific examples are used to describe theprinciples and implementations of the disclosure, and the description ofthe embodiments is only intended to make the method and core idea of thedisclosure more comprehensible. In addition, a person of ordinary skillin the art may, based on the idea of the disclosure, make modificationswith respect to the specific implementations and the application scope.Therefore, the content of this specification shall not be construed as alimitation to the disclosure.

What is claimed is:
 1. A handshake synchronization restoration method,comprising: after a transmitting end in which a state machine varieswith unit time is powered on again, transmitting, by the transmittingend, in the form of a visible light signal, to a receive and controlsystem, a status reset signal which varies with unit time, wherein thereceive and control system comprises one or multiple receiving ends; andreceiving, by the receive and control system, the visible light signal,and when it is determined that the received visible light signal is astatus reset signal, adjusting, by the receive and control system,status of a state machine of a receiving end to a state indicated by thestatus reset signal; wherein before the method, further comprising:connecting, by the transmitting end, to the receive and control system,and adjusting, by the receive and control system, the status of thestate machine of the receiving end to be synchronous with status of thestate machine of the transmitting end; performing, by the transmittingend, a logical operation on an original signal and a pilot opticalsignal separately with a pseudocode signal of the current period of timeto obtain an encrypted original signal and an encrypted pilot opticalsignal, combining the encrypted original signal and the encrypted pilotoptical signal to obtain the scrambled signal, and sending the scrambledsignal in the form of a visible light signal; and receiving, by thereceive and control system, the scrambled signal, and decomposing thescrambled code into the encrypted original signal and the encryptedpilot optical signal; performing a logical operation on the encryptedpilot optical signal with a prestored pseudocode signal corresponding toa state machine of all users in the current period of time, andidentifying a pseudocode signal corresponding to the pilot opticalsignal in the current status according to relevant peaks; and using thepseudocode signal corresponding to the current status to decrypt theencrypted original signal.
 2. The method according to claim 1, whereinthe method further comprises: comparing, by the receive and controlsystem, a decrypted original signal with a prestored original signal,and determining legality of a received original signal; and controlling,by the receive and control system if determining that the receivedoriginal signal is legal, an action of a functional unit connected tothe receive and control system.
 3. The method according to claim 1,wherein frequencies of the original signal, the pilot optical signal,and the pseudocode signal are the same or in an integer multiplerelationship, and start and end phases of the original signal, the pilotoptical signal, and the pseudocode signal are the same.
 4. The methodaccording to claim 1, wherein before the sending the scrambled signal inthe form of a visible light signal, the method further comprises:modulating, by the transmitting end, the scrambled signal; andcorrespondingly, after the receiving, by the receive and control system,the visible light signal, the method further comprises: demodulating, bythe receive and control system, the digital signal.
 5. A handshakesynchronization restoration system, comprising a transmitting end and areceive and control system, wherein the receive and control systemcomprises one or multiple receiving ends; the transmitting end in whicha state machine varies with unit time comprises: a status reset unit totransmit, to the receive and control system, a status reset signal whichvaries with unit time, after being powered on; and a transmitting unit,connected to the status reset unit, to transmit the status reset signalin the form of a visible light signal; and each receiving end of thereceive and control system comprises: a receiving unit to receive thevisible light signal; and a status reset determiner, connected to thereceiving unit, to output, when it is determined that the receivedvisible light signal is a status reset signal, an instruction foradjusting status of a state machine to a state indicated by the statusreset signal; wherein the transmitting end further comprises: apseudocode generator, connected to the status reset unit, to output apseudocode signal which varies with unit time; a pilot optical signalgenerator to output a pilot optical signal; and an encoder to perform alogical operation on an original signal and a pilot optical signalseparately with a pseudocode signal of the current period of time toobtain an encrypted original signal and an encrypted pilot opticalsignal, and combine the encrypted original signal and the encryptedpilot optical signal to obtain the scrambled signal; and the receivingend further comprises: a pseudocode determiner, connected to the statusreset determiner, to perform a logical operation on the encrypted pilotoptical signal, which is output by the status reset determiner, with apseudocode signal that is prestored in the system and corresponds to astate machine of all users in the current period of time, and determinea pseudocode signal corresponding to current status of a period of timeaccording to relevant peaks; and a decoder, connected to the statusreset determiner, to use the pseudocode signal corresponding to thecurrent status to decrypt the encrypted original signal output by thestatus reset determiner.
 6. The system according to claim 1, wherein thereceiving end further comprises: an original signal determiner,connected to the decoder and the pseudocode determiner, to compare adecrypted original signal with an original signal prestored in thepseudocode determiner and determine legality of a received originalsignal.
 7. The system according to claim 1, wherein the transmitting endfurther comprises: a modulator, connected between the encoder and thesending unit, to modulate the scrambled signal; and correspondingly, thereceive and control system further comprises: a demodulator, connectedbetween the receiving unit and the decomposing unit, to demodulate thedigital signal.
 8. The system according to claim 5, wherein the receiveand control system comprises a system control platform connected to thereceiving end.